Documentation
¶
Overview ¶
Package claude provides token refresh functionality for Anthropic credentials used by the scheduler.
Package claude provides authentication functionality for Anthropic's Claude API. This file implements a custom HTTP transport using utls to bypass TLS fingerprinting.
Index ¶
Constants ¶
View Source
const ( TokenURL = "https://api.anthropic.com/v1/oauth/token" ClientID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClaudeAuth ¶
type ClaudeAuth struct {
// contains filtered or unexported fields
}
func NewClaudeAuth ¶
func NewClaudeAuth(cfg *config.Config) *ClaudeAuth
func NewClaudeAuthWithProxyURL ¶
func NewClaudeAuthWithProxyURL(cfg *config.Config, proxyURL string) *ClaudeAuth
NewClaudeAuthWithProxyURL creates a new refresh client instance. proxyURL takes precedence over cfg.ProxyURL when non-empty.
func (*ClaudeAuth) RefreshTokens ¶
func (o *ClaudeAuth) RefreshTokens(ctx context.Context, refreshToken string) (*ClaudeTokenData, error)
RefreshTokens refreshes access token via refresh token.
func (*ClaudeAuth) RefreshTokensWithRetry ¶
func (o *ClaudeAuth) RefreshTokensWithRetry(ctx context.Context, refreshToken string, maxRetries int) (*ClaudeTokenData, error)
type ClaudeTokenData ¶
type ClaudeTokenData struct {
// AccessToken is the OAuth2 access token for API access
AccessToken string `json:"access_token"`
// RefreshToken is used to obtain new access tokens
RefreshToken string `json:"refresh_token"`
// Email is the Anthropic account email
Email string `json:"email"`
// Expire is the timestamp of the token expire
Expire string `json:"expired"`
}
ClaudeTokenData holds OAuth token information from Anthropic
Click to show internal directories.
Click to hide internal directories.