Overview
Providers abstract LLM API interactions, enabling PicoClaw to work with multiple AI models and services through a unified interface. The provider system supports automatic fallback, load balancing, and zero-code provider addition.Provider Interface
All providers implement theLLMProvider interface (pkg/providers/types.go):
Supported Providers
HTTP-Compatible Providers
Providers using OpenAI-compatible HTTP API (pkg/providers/http_provider.go):
Native Providers
Claude Provider (pkg/providers/claude_provider.go)
Native Anthropic API implementation with:
- Prompt caching
- Extended thinking
- Vision support
Codex Provider (pkg/providers/codex_provider.go)
OpenAI OAuth/token authentication.
GitHub Copilot (pkg/providers/github_copilot_provider.go)
gRPC connection to local GitHub Copilot agent.
Model List Configuration
The modern way to configure providers: zero-code model addition.Basic Configuration
Model Entry Fields
Provider Auto-Detection
Providers are automatically selected based on model prefix:Custom API Base
Override default endpoints:Request Timeout
Set per-model timeout:Load Balancing
Multiple entries with samemodel_name enable round-robin load balancing:
- Requests alternate between endpoints
- Reduces single-endpoint rate limits
- Improves availability
Fallback Chain
Automatic failover when primary model fails.Configuration
Method 1: Model-specificFallback Execution
Implemented inpkg/providers/fallback.go:
Error Classification
Defined inpkg/providers/error_classifier.go:
Cooldown Tracking
Prevents rapid retries after rate limit:Legacy Provider Configuration
Deprecated but still supported for backward compatibility.Legacy Format
Migration to model_list
Before:Provider Selection Logic
Implemented inpkg/providers/factory.go:
Provider Resolution Examples
Special Providers
OpenRouter
Universal model router supporting all major providers:- OpenAI (GPT-4, GPT-3.5, etc.)
- Anthropic (Claude)
- Google (Gemini)
- Meta (Llama)
- And 100+ other models
LiteLLM Proxy
Connect to LiteLLM proxy for unified model access:litellm/ prefix. The rest is passed to the proxy.