Documentation
¶
Overview ¶
Package auto provides zero-config multi-provider setup for LLM providers.
Index ¶
- Constants
- func New(ctx context.Context, opts ...Option) (*aggregate.Provider, error)
- type Option
- func WithAnthropic() Option
- func WithBedrock() Option
- func WithClaude(store claude.TokenStore) Option
- func WithClaudeAccount(name string, store claude.TokenStore) Option
- func WithClaudeLocal() Option
- func WithName(name string) Option
- func WithOpenAI() Option
- func WithOpenRouter() Option
- func WithoutAutoDetect() Option
Constants ¶
const ( ProviderClaude = "claude" ProviderBedrock = "bedrock" ProviderOpenAI = "openai" ProviderOpenRouter = "openrouter" ProviderAnthropic = "anthropic" )
Provider type names.
const ( EnvOpenAIKey = "OPENAI_API_KEY" EnvOpenAIKeyAlt = "OPENAI_KEY" EnvOpenRouterKey = "OPENROUTER_API_KEY" EnvAnthropicKey = "ANTHROPIC_API_KEY" )
Environment variable names.
const ( AliasFast = "fast" AliasDefault = "default" AliasPowerful = "powerful" )
Global model aliases.
const ( ClaudeOpus = "claude-opus-4-6" ClaudeSonnet = "claude-sonnet-4-6" ClaudeHaiku = "claude-haiku-4-5-20251001" )
Claude model IDs.
const ( BedrockOpus = "anthropic.claude-opus-4-20250514-v1:0" BedrockSonnet = "anthropic.claude-sonnet-4-20250514-v1:0" BedrockHaiku = "anthropic.claude-3-5-haiku-20241022-v1:0" )
Bedrock model IDs.
const ( AnthropicOpus = ClaudeOpus AnthropicSonnet = ClaudeSonnet AnthropicHaiku = ClaudeHaiku )
Anthropic model IDs (same as Claude, different provider).
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates an aggregate provider with auto-detected or explicitly configured providers.
Without options, it auto-detects available providers:
- Claude local (~/.claude credentials)
- AWS Bedrock (always included)
- Anthropic direct API (if ANTHROPIC_API_KEY is set)
- OpenAI (if OPENAI_API_KEY or OPENAI_KEY is set)
- OpenRouter (if OPENROUTER_API_KEY is set)
With explicit options, you can configure specific providers:
auto.New(ctx,
auto.WithName("myapp"),
auto.WithClaude(tokenStore), // Claude accounts from store
auto.WithClaudeLocal(), // Claude local credentials
auto.WithBedrock(), // AWS Bedrock
)
Types ¶
type Option ¶
type Option func(*config)
Option configures the auto provider.
func WithAnthropic ¶
func WithAnthropic() Option
WithAnthropic adds direct Anthropic API provider. Requires ANTHROPIC_API_KEY environment variable.
func WithClaude ¶
func WithClaude(store claude.TokenStore) Option
WithClaude adds all Claude OAuth accounts from a TokenStore. Each account key becomes a separate provider instance with name equal to the key.
func WithClaudeAccount ¶
func WithClaudeAccount(name string, store claude.TokenStore) Option
WithClaudeAccount adds a specific Claude OAuth account.
func WithClaudeLocal ¶
func WithClaudeLocal() Option
WithClaudeLocal adds the local Claude credentials (~/.claude).
func WithOpenAI ¶
func WithOpenAI() Option
WithOpenAI adds OpenAI provider. Requires OPENAI_API_KEY or OPENAI_KEY environment variable.
func WithOpenRouter ¶
func WithOpenRouter() Option
WithOpenRouter adds OpenRouter provider. Requires OPENROUTER_API_KEY environment variable.
func WithoutAutoDetect ¶
func WithoutAutoDetect() Option
WithoutAutoDetect disables auto-detection of providers. Use this when you want to explicitly configure all providers.