Documentation
¶
Index ¶
- func ContextWindowSuggests1M(window int) bool
- func GetAnthropicModels(baseURL, key string) (string, error)
- func GetAnthropicModelsWithAuth(baseURL, key, authStyle string) (string, error)
- func GetOpenAIModels(baseURL, apiKey string) (string, error)
- func InvalidCodexV1EndpointSuggestion(endpoint string) (string, bool)
- func IsCodexBaseEndpoint(baseURL string) bool
- func NormalizeAnthropicBaseURLForClaude(baseURL string) string
- func NormalizeAnthropicMessagesURL(baseURL string) string
- func NormalizeAnthropicModelsURL(baseURL string) string
- func NormalizeOpenAIChatCompletionsURL(baseURL string) string
- func NormalizeOpenAIModelsURL(baseURL string) string
- func NormalizeOpenAIResponsesURL(baseURL string) string
- func ProbeOpenAIResponsesSupport(endpoint, apiKey, model string, timeout time.Duration) bool
- func ProbeOpenAIResponsesSupportContext(parent context.Context, endpoint, apiKey, model string, timeout time.Duration) bool
- type AnthropicModelResponse
- type ModelInfo
- type ModelResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWindowSuggests1M ¶ added in v1.3.5
ContextWindowSuggests1M reports whether a catalog context_window looks like a 1M-class window. Values are advisory suggestions only.
func GetAnthropicModels ¶
func GetAnthropicModelsWithAuth ¶ added in v1.2.5
GetAnthropicModelsWithAuth fetches Anthropic-compatible models using either the official x-api-key header or a Bearer token used by some routers.
func GetOpenAIModels ¶
GetOpenAIModels fetches the comma-separated model IDs from an OpenAI-compatible /models endpoint.
func InvalidCodexV1EndpointSuggestion ¶ added in v1.3.1
InvalidCodexV1EndpointSuggestion identifies a user-supplied Codex generation endpoint ending in /codex/v1 and returns the base endpoint the user should enter instead. ccl reports this suggestion but never rewrites the setting.
func IsCodexBaseEndpoint ¶ added in v1.3.1
IsCodexBaseEndpoint reports whether baseURL points at a dedicated Codex base path such as https://example.com/codex. Model discovery is performed at the corresponding /codex/models endpoint without rewriting the configured base.
func NormalizeAnthropicBaseURLForClaude ¶ added in v1.2.5
NormalizeAnthropicBaseURLForClaude returns the base URL shape expected by Claude Code's Anthropic client. Claude appends /v1/messages itself, so a configured endpoint ending in /v1, /v1/messages, or /v1/models would otherwise become /v1/v1/messages at runtime.
func NormalizeAnthropicMessagesURL ¶ added in v1.2.4
func NormalizeAnthropicModelsURL ¶ added in v1.2.4
func NormalizeOpenAIChatCompletionsURL ¶ added in v1.2.4
func NormalizeOpenAIModelsURL ¶ added in v1.2.4
func NormalizeOpenAIResponsesURL ¶ added in v1.2.4
func ProbeOpenAIResponsesSupport ¶ added in v1.2.4
ProbeOpenAIResponsesSupport sends a minimal, real generation request to the /v1/responses endpoint to determine whether an OpenAI-compatible gateway implements the newer Responses API ("openai(responses)") as opposed to only the legacy Chat Completions API ("openai(chat)"). Listing models alone (/v1/models) cannot distinguish these two, since both protocols commonly share the same model catalog — an actual call to /v1/responses is required. Returns true only when the upstream responds with a 2xx status.
Types ¶
type AnthropicModelResponse ¶
type AnthropicModelResponse struct {
Data []struct {
CreatedAt time.Time `json:"created_at"`
DisplayName string `json:"display_name"`
Id string `json:"id"`
Type string `json:"type"`
} `json:"data"`
FirstId string `json:"firstId"`
HasMore bool `json:"hasMore"`
LastId string `json:"lastId"`
}
AnthropicModelResponse is the Anthropic-compatible /v1/models list payload.
type ModelInfo ¶ added in v1.3.5
ModelInfo is one entry from an OpenAI-compatible /models response. ContextWindow is advisory only — third-party catalogs are often wrong or missing; callers must not treat a reported 1M window as a guarantee.
func GetOpenAIModelInfos ¶ added in v1.3.5
GetOpenAIModelInfos fetches model IDs and optional context_window metadata.
type ModelResponse ¶
type ModelResponse struct {
Data []struct {
Created int `json:"created"`
Domain string `json:"domain"`
Features struct {
StructuredOutputs struct {
JsonObject bool `json:"json_object"`
JsonSchema bool `json:"json_schema"`
} `json:"structured_outputs,omitempty"`
Tools struct {
FunctionCalling bool `json:"function_calling"`
} `json:"tools,omitempty"`
Batch struct {
BatchChat bool `json:"batch_chat"`
BatchJob bool `json:"batch_job"`
} `json:"batch,omitempty"`
Cache struct {
PrefixCache bool `json:"prefix_cache"`
SessionCache bool `json:"session_cache"`
} `json:"cache,omitempty"`
} `json:"features"`
Id string `json:"id"`
Name string `json:"name"`
Object string `json:"object"`
Status string `json:"status,omitempty"`
Version string `json:"version"`
ContextWindow int `json:"context_window,omitempty"`
Modalities struct {
InputModalities []string `json:"input_modalities,omitempty"`
OutputModalities []string `json:"output_modalities,omitempty"`
} `json:"modalities,omitempty"`
TaskType []string `json:"task_type,omitempty"`
TokenLimits struct {
ContextWindow int `json:"context_window,omitempty"`
MaxInputTokenLength int `json:"max_input_token_length,omitempty"`
MaxOutputTokenLength int `json:"max_output_token_length,omitempty"`
MaxReasoningTokenLength int `json:"max_reasoning_token_length,omitempty"`
} `json:"token_limits,omitempty"`
} `json:"data"`
Object string `json:"object"`
}
ModelResponse is the OpenAI-compatible /models list payload. Context windows appear either nested under token_limits (some gateways) or as a top-level context_window (CLIProxyAPI / OpenAI-style catalogs).