01 · providers
Multi-Provider Support.
Anthropic, OpenAI, Ollama, and GLM behind a single AgentOptions surface. Swap the provider — the rest of your agent code stays identical.
// Anthropic
let agent = createAgent(options: AgentOptions(
provider: .anthropic,
apiKey: ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"]!,
model: "claude-sonnet-4-6"
))
// OpenAI
let agent = createAgent(options: AgentOptions(
provider: .openai,
apiKey: "sk-...",
model: "gpt-4o"
))
// Ollama (local)
let agent = createAgent(options: AgentOptions(
provider: .ollama,
baseURL: "http://localhost:11434",
model: "llama3.1"
))