Documentation
¶
Index ¶
Constants ¶
const AIMLAPIID = "aimlapi"
AIMLAPIID is the provider catalog identifier for the aimlapi.com preset.
Variables ¶
var ErrUnknownProvider = errors.New("unknown provider")
Functions ¶
func IsCatalogBaseURL ¶ added in v0.13.0
func IsCatalogBaseURL(descriptor Descriptor, baseURL string) bool
IsCatalogBaseURL reports whether baseURL addresses the descriptor's own endpoint: its DefaultBaseURL or one of its LegacyBaseURLs, ignoring case, surrounding space, and a trailing slash. An empty baseURL never matches.
func NormalizeID ¶
func RuntimeSupported ¶
func RuntimeSupported(descriptor Descriptor) bool
func RuntimeUnsupportedReason ¶
func RuntimeUnsupportedReason(descriptor Descriptor) string
Types ¶
type APIFormat ¶
type APIFormat string
const ( APIFormatOpenAIResponses APIFormat = "responses" APIFormatOpenAIChatCompletions APIFormat = "chat-completions" APIFormatAnthropicMessages APIFormat = "messages" APIFormatGoogleGenerateContent APIFormat = "generate-content" APIFormatBedrockConverse APIFormat = "bedrock-converse" APIFormatVertexGenerateContent APIFormat = "vertex-generate-content" )
type Descriptor ¶
type Descriptor struct {
ID string
Name string
Transport Transport
DefaultBaseURL string
DefaultModel string
AuthEnvVars []string
CustomHeaders map[string]string
RequiresAuth bool
UsesAmbientAuth bool
Public bool
Local bool
SupportedAPIFormats []APIFormat
Aliases []string
// Custom marks the "bring your own endpoint" catalog entries
// (custom-openai-compatible, custom-anthropic-compatible). Unlike every other
// descriptor, RequiresAuth here is just a template default for the credential
// wizard step, not a fact about the user's actual endpoint — a custom target may
// or may not need auth, so callers deciding whether a *saved profile* is missing
// a credential must not treat RequiresAuth as authoritative for these entries.
Custom bool
// OAuth reports that this provider offers an in-app OAuth login that yields a
// credential usable for model calls (browser PKCE and/or device code). Only
// set for providers where this actually works (not subscription-via-proxy).
OAuth bool
// OAuthMintsKey reports that the OAuth flow returns/mints a normal API key
// (e.g. OpenRouter) rather than a bearer token used directly.
OAuthMintsKey bool
// OAuthDeviceFlow reports that RFC 8628 device-code login is supported (for
// headless / SSH use) in addition to the browser flow.
OAuthDeviceFlow bool
// Recommended marks a provider surfaced at the top and badged in
// catalog-ordered lists and pickers. The recommended descriptors are the first
// entries in the catalog, in order.
Recommended bool
// LegacyBaseURLs lists earlier DefaultBaseURL values that still address
// this provider's own endpoint. Profiles saved against one keep catalog
// endpoint treatment (catalog env var binding, base-URL matching) after the
// default moves; see IsCatalogBaseURL.
LegacyBaseURLs []string
}
func All ¶
func All() []Descriptor
func Find ¶ added in v0.14.0
func Find(pred func(Descriptor) bool) (Descriptor, bool)
Find returns the first catalog entry matching pred. The predicate reads the internal (uncloned) descriptors, so scanning on a hot path costs no allocations; only a match pays the single clone that Get already pays.
func Get ¶
func Get(id string) (Descriptor, bool)
func OAuthProviders ¶
func OAuthProviders() []Descriptor
OAuthProviders returns the catalog descriptors that support an in-app OAuth login, in catalog order. It is the single source of truth for the wizard's dedicated "Sign in with OAuth" provider list.
func Require ¶
func Require(id string) (Descriptor, error)
type Transport ¶
type Transport string
const ( TransportOpenAI Transport = "openai" TransportAnthropic Transport = "anthropic" TransportGoogle Transport = "google" TransportBedrock Transport = "bedrock" TransportVertex Transport = "vertex" TransportOpenAICompatible Transport = "openai-compatible" TransportOpenAICompat Transport = TransportOpenAICompatible TransportAnthropicCompatible Transport = "anthropic-compatible" TransportAnthropicCompat Transport = TransportAnthropicCompatible )