claude

package
v6.2.33 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package claude provides HTTP handlers for Claude API code-related functionality. This package implements Claude-compatible streaming chat completions with sophisticated client rotation and quota management systems to ensure high availability and optimal resource utilization across multiple backend clients. It handles request translation between Claude API format and the underlying Gemini backend, providing seamless API compatibility while maintaining robust error handling and connection management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeCodeAPIHandler

type ClaudeCodeAPIHandler struct {
	*handlers.BaseAPIHandler
}

ClaudeCodeAPIHandler contains the handlers for Claude API endpoints. It holds a pool of clients to interact with the backend service.

func NewClaudeCodeAPIHandler

func NewClaudeCodeAPIHandler(apiHandlers *handlers.BaseAPIHandler) *ClaudeCodeAPIHandler

NewClaudeCodeAPIHandler creates a new Claude API handlers instance. It takes an BaseAPIHandler instance as input and returns a ClaudeCodeAPIHandler.

Parameters:

  • apiHandlers: The base API handler instance.

Returns:

  • *ClaudeCodeAPIHandler: A new Claude code API handler instance.

func (*ClaudeCodeAPIHandler) ClaudeCountTokens

func (h *ClaudeCodeAPIHandler) ClaudeCountTokens(c *gin.Context)

ClaudeMessages handles Claude-compatible streaming chat completions. This function implements a sophisticated client rotation and quota management system to ensure high availability and optimal resource utilization across multiple backend clients.

Parameters:

  • c: The Gin context for the request.

func (*ClaudeCodeAPIHandler) ClaudeMessages

func (h *ClaudeCodeAPIHandler) ClaudeMessages(c *gin.Context)

ClaudeMessages handles Claude-compatible streaming chat completions. This function implements a sophisticated client rotation and quota management system to ensure high availability and optimal resource utilization across multiple backend clients.

Parameters:

  • c: The Gin context for the request.

func (*ClaudeCodeAPIHandler) ClaudeModels

func (h *ClaudeCodeAPIHandler) ClaudeModels(c *gin.Context)

ClaudeModels handles the Claude models listing endpoint. It returns a JSON response containing available Claude models and their specifications.

Parameters:

  • c: The Gin context for the request.

func (*ClaudeCodeAPIHandler) HandlerType

func (h *ClaudeCodeAPIHandler) HandlerType() string

HandlerType returns the identifier for this handler implementation.

func (*ClaudeCodeAPIHandler) Models

func (h *ClaudeCodeAPIHandler) Models() []map[string]any

Models returns a list of models supported by this handler.

Jump to

Keyboard shortcuts

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