Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIProvider ¶
type APIProvider string
APIProvider represents an LLM provider
const ( APIProviderOpenAI APIProvider = "openai" APIProviderAnthropic APIProvider = "anthropic" APIProviderGoogle APIProvider = "google" APIProviderGemini APIProvider = "gemini" APIProviderOllama APIProvider = "ollama" APIProviderAzure APIProvider = "azure" APIProviderZAI APIProvider = "z" APIProviderMiniMax APIProvider = "minimax" )
type AuthMethod ¶
type AuthMethod string
AuthMethod represents the authentication method used
const ( AuthMethodAPIKey AuthMethod = "api_key" AuthMethodOAuth AuthMethod = "oauth" )
type Config ¶
type Config struct {
DefaultAuth string `json:"default_auth"`
Providers map[string]ProviderConfig `json:"providers"`
}
Config represents auth configuration
type Credentials ¶
type Credentials struct {
Provider string `json:"provider"`
AuthMethod AuthMethod `json:"auth_method"`
APIKey string `json:"api_key,omitempty"`
TokenRef string `json:"token_ref,omitempty"`
OAuth *OAuthCredentials `json:"oauth,omitempty"`
// Token holds the live OAuth token data (access, refresh, expiry).
// Populated when AuthMethod == AuthMethodOAuth.
Token *Token `json:"token,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Credentials represents authentication credentials
type OAuthCredentials ¶
type OAuthCredentials struct {
BaseURL string `json:"base_url"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret,omitempty"`
AuthURL string `json:"auth_url"`
TokenURL string `json:"token_url"`
Scopes []string `json:"scopes"`
DeviceAuthURL string `json:"device_auth_url,omitempty"`
DeviceTokenURL string `json:"device_token_url,omitempty"`
}
OAuthCredentials holds OAuth-specific configuration
type ProviderConfig ¶
type ProviderConfig struct {
AuthMethod AuthMethod `json:"auth_method"`
APIKey string `json:"api_key"`
OAuth *OAuthCredentials `json:"oauth"`
}
ProviderConfig holds configuration for a specific provider
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
IDToken string `json:"id_token,omitempty"`
TokenType TokenType `json:"token_type"`
ExpiresAt time.Time `json:"expires_at"`
Scope string `json:"scope,omitempty"`
AccountID string `json:"account_id,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
}
Token represents an OAuth token
func (*Token) IsExpired ¶
IsExpired returns true if the token is expired or will expire within the given duration
func (*Token) NeedsRefresh ¶
NeedsRefresh returns true if the token should be refreshed
Click to show internal directories.
Click to hide internal directories.