core.Provider interface decouples your agent logic from any specific SDK. Swapping providers requires changing exactly one line.
Available providers
| Provider | Package | Shorthand |
|---|---|---|
| Anthropic (Claude) | pkg/providers/anthropic | WithAnthropic(key, model) |
| OpenAI | pkg/providers/openai | WithOpenAI(key, model) |
| Google Gemini | pkg/providers/gemini | WithGemini(key, model) |
| Ollama | pkg/providers/ollama | WithOllama(url, model) |
| Any OpenAI-compatible API | pkg/providers/openai | WithOpenAICompatible(key, url, name, model) |
Usage
Gemini convenience constructors
Thepkg/providers/gemini package includes named constructors for common models:
Custom provider
Implementcore.Provider to add any backend:
pkg/core has zero external dependencies — a custom provider never pulls any SDK into your binary unless you need it.