Quick Start
How It Works
Supported Providers
| Provider | Model String | Example |
|---|---|---|
| OpenAI | openai/model | openai/gpt-4o, openai/gpt-4o-mini |
| Anthropic | anthropic/model | anthropic/claude-3-5-sonnet-latest |
google/model | google/gemini-2.0-flash | |
| Groq | groq/model | groq/llama-3.3-70b-versatile |
| Mistral | mistral/model | mistral/mistral-large-latest |
| Cohere | cohere/model | cohere/command-r-plus |
| DeepSeek | deepseek/model | deepseek/deepseek-chat |
| xAI | xai/model | xai/grok-2 |
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

