api

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MimeTypes = map[string]string{}/* 732 elements not displayed */

Functions

func AuthMiddleware

func AuthMiddleware(cfg *ServerConfig) gin.HandlerFunc

AuthMiddleware authenticates requests using API keys

Types

type APIHandlers

type APIHandlers struct {
	// contains filtered or unexported fields
}

APIHandlers contains the handlers for API endpoints

func NewAPIHandlers

func NewAPIHandlers(cliClients []*client.Client, debug bool) *APIHandlers

NewAPIHandlers creates a new API handlers instance

func (*APIHandlers) ChatCompletions

func (h *APIHandlers) ChatCompletions(c *gin.Context)

ChatCompletions handles the /v1/chat/completions endpoint

func (*APIHandlers) Models

func (h *APIHandlers) Models(c *gin.Context)

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Code    string `json:"code,omitempty"`
}

ErrorDetail represents error details

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

ErrorResponse represents an error response

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the API server

func NewServer

func NewServer(config *ServerConfig, cliClients []*client.Client) *Server

NewServer creates a new API server instance

func (*Server) Start

func (s *Server) Start() error

Start starts the API server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully stops the API server

type ServerConfig

type ServerConfig struct {
	Port    string
	Debug   bool
	ApiKeys []string
}

ServerConfig contains configuration for the API server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL