Documentation
¶
Overview ¶
Package gemini provides HTTP handlers for Gemini CLI API functionality. This package implements handlers that process CLI-specific requests for Gemini API operations, including content generation and streaming content generation endpoints. The handlers restrict access to localhost only and manage communication with the backend service.
Package gemini provides HTTP handlers for Gemini API endpoints. This package implements handlers for managing Gemini model operations including model listing, content generation, streaming content generation, and token counting. It serves as a proxy layer between clients and the Gemini backend service, handling request translation, client management, and response processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeminiAPIHandler ¶
type GeminiAPIHandler struct {
*handlers.BaseAPIHandler
}
GeminiAPIHandler contains the handlers for Gemini API endpoints. It holds a pool of clients to interact with the backend service.
func NewGeminiAPIHandler ¶
func NewGeminiAPIHandler(apiHandlers *handlers.BaseAPIHandler) *GeminiAPIHandler
NewGeminiAPIHandler creates a new Gemini API handlers instance. It takes an BaseAPIHandler instance as input and returns a GeminiAPIHandler.
func (*GeminiAPIHandler) GeminiGetHandler ¶
func (h *GeminiAPIHandler) GeminiGetHandler(c *gin.Context)
GeminiGetHandler handles GET requests for specific Gemini model information. It returns detailed information about a specific Gemini model based on the action parameter.
func (*GeminiAPIHandler) GeminiHandler ¶
func (h *GeminiAPIHandler) GeminiHandler(c *gin.Context)
GeminiHandler handles POST requests for Gemini API operations. It routes requests to appropriate handlers based on the action parameter (model:method format).
func (*GeminiAPIHandler) GeminiModels ¶
func (h *GeminiAPIHandler) GeminiModels(c *gin.Context)
GeminiModels handles the Gemini models listing endpoint. It returns a JSON response containing available Gemini models and their specifications.
func (*GeminiAPIHandler) HandlerType ¶
func (h *GeminiAPIHandler) HandlerType() string
HandlerType returns the identifier for this handler implementation.
func (*GeminiAPIHandler) Models ¶
func (h *GeminiAPIHandler) Models() []map[string]any
Models returns the Gemini-compatible model metadata supported by this handler.
type GeminiCLIAPIHandler ¶
type GeminiCLIAPIHandler struct {
*handlers.BaseAPIHandler
}
GeminiCLIAPIHandler contains the handlers for Gemini CLI API endpoints. It holds a pool of clients to interact with the backend service.
func NewGeminiCLIAPIHandler ¶
func NewGeminiCLIAPIHandler(apiHandlers *handlers.BaseAPIHandler) *GeminiCLIAPIHandler
NewGeminiCLIAPIHandler creates a new Gemini CLI API handlers instance. It takes an BaseAPIHandler instance as input and returns a GeminiCLIAPIHandler.
func (*GeminiCLIAPIHandler) CLIHandler ¶
func (h *GeminiCLIAPIHandler) CLIHandler(c *gin.Context)
CLIHandler handles CLI-specific requests for Gemini API operations. It restricts access to localhost only and routes requests to appropriate internal handlers.
func (*GeminiCLIAPIHandler) HandlerType ¶
func (h *GeminiCLIAPIHandler) HandlerType() string
HandlerType returns the type of this handler.
func (*GeminiCLIAPIHandler) Models ¶
func (h *GeminiCLIAPIHandler) Models() []map[string]any
Models returns a list of models supported by this handler.