Quick Start
1
Simple Usage
2
With Configuration
3
Switch Providers with One Line
How It Works
Supported Providers
Common Patterns
Agent with Tools
Structured Output
Multi-Agent Pipeline
Environment Variables
Best Practices
Use the provider/model string format
Use the provider/model string format
Always use
"provider/model" strings ("openai/gpt-4o-mini") rather than provider-specific config objects. Switching providers is a one-line change.Install provider packages only when needed
Install provider packages only when needed
Core PraisonAI bundles OpenAI support. For other providers install
@ai-sdk/anthropic, @ai-sdk/google, etc. only when you use them.Match model to task
Match model to task
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.Store API keys in environment variables
Store API keys in environment variables
Never hard-code API keys. Use environment variables (
OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.). For production deployments use a secrets manager.Related
Providers
Full provider reference and configuration
Structured Output
Type-safe JSON responses

