Skip to main content
Switch between any LLM provider — OpenAI, Anthropic, Google, and more — without changing your agent code.

Quick Start

1

Simple Usage

2

With Configuration

3

Switch Providers with One Line


How It Works


Model String Resolution

PraisonAI resolves a model string in three tiers: explicit prefix > prefix inference > OpenAI fallback. A bare name plus a custom baseURL stays on the OpenAI-compatible path — see The baseURL exception.

Supported Providers


Common Patterns

Agent with Tools

Tools work identically on every provider — swap the llm string (openai/..., google/..., groq/..., ollama/...) with no other code change.

Structured Output

outputSchema takes a JSON Schema object (not a Zod schema) and constrains the model to matching JSON on every provider. OpenAI uses native response_format: json_schema; other providers (Anthropic, Google, Groq, Mistral, Ollama, …) route through the AI SDK backend’s generateObject({ schema }). See Structured Output.
outputSchema works on every provider from PraisonAI PR #4412 onward. Reasoning families (gpt-5*, o1*, o3*, o4*) still omit temperature automatically. See Output → Schema-constrained output.

Multi-Agent Pipeline

Environment Variables


Best Practices

Always use "provider/model" strings ("openai/gpt-4o-mini") rather than provider-specific config objects. Switching providers is a one-line change.
Core PraisonAI bundles OpenAI support. For other providers install @ai-sdk/anthropic, @ai-sdk/google, etc. only when you use them.
For quick tasks use openai/gpt-4o-mini or google/gemini-2.0-flash. For complex reasoning use anthropic/claude-3-5-sonnet-latest or openai/gpt-4o. Mix providers across agents in multi-agent workflows.
Never hard-code API keys. Use environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.). For production deployments use a secrets manager.

Providers

Full provider reference and configuration

Structured Output

Type-safe JSON responses