Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIHandlers ¶
type APIHandlers struct { Credentials []config.Credential VendorModels []config.VendorModel APIClient *proxy.APIClient ModelSelector selector.Selector }
APIHandlers contains the dependencies needed for API handlers
func NewAPIHandlers ¶
func NewAPIHandlers(creds []config.Credential, models []config.VendorModel, client *proxy.APIClient, selector selector.Selector) *APIHandlers
NewAPIHandlers creates a new APIHandlers instance
func (*APIHandlers) ChatCompletionsHandler ¶
func (h *APIHandlers) ChatCompletionsHandler(w http.ResponseWriter, r *http.Request)
ChatCompletionsHandler handles the chat completions endpoint @Summary Chat completions API @Description Routes chat completion requests to different language model providers @Tags chat @Accept json @Produce json @Param vendor query string false "Optional vendor to target (e.g., 'openai', 'gemini')" @Param request body ChatCompletionRequest true "Chat completion request in OpenAI-compatible format" @Security BearerAuth @Success 200 {object} ChatCompletionResponse "OpenAI-compatible chat completion response" @Failure 400 {object} ErrorResponse "Bad request error" @Failure 401 {object} ErrorResponse "Unauthorized error" @Failure 500 {object} ErrorResponse "Internal server error" @Router /v1/chat/completions [post]
func (*APIHandlers) HealthHandler ¶
func (h *APIHandlers) HealthHandler(w http.ResponseWriter, r *http.Request)
HealthHandler handles the health check endpoint @Summary Health check endpoint @Description Returns "OK" if the service is running properly @Tags health @Accept json @Produce plain @Success 200 {string} string "OK" @Router /health [get]
func (*APIHandlers) ModelsHandler ¶
func (h *APIHandlers) ModelsHandler(w http.ResponseWriter, r *http.Request)
ModelsHandler handles the models endpoint @Summary List available models @Description Returns a list of available language models in OpenAI-compatible format @Tags models @Accept json @Produce json @Param vendor query string false "Optional vendor to filter models (e.g., 'openai', 'gemini')" @Success 200 {object} ModelsResponse "List of available models" @Router /v1/models [get]