Skip to main content
Point an Agent at any provider by setting its llm parameter — PraisonAI routes to OpenAI, Anthropic, Gemini, Groq, Cohere, or a local Ollama model.
Not sure which model to use? Run praisonai models list to browse all available models, or see the Model Catalogue CLI for full details on browsing, describing, and validating models.

Code

Set model by 3 ways

1. OpenAI Compatible Endpoints

By Default it uses OPENAI_BASE_URL https://api.openai.com/v1
Example Groq Implementation:

2. Litellm Compatible model names (eg: gemini/gemini-1.5-flash-8b)

3. Litellm Compatible Configuration

Advanced Configuration (Litellm Support)

This uses Litellm
1

Install Package

Install required packages:
2

Setup Environment

Configure environment:
Get your API key from Google AI Studio
3

Create Agent

Create app.py:

Ollama Integration

Groq Integration

Google Gemini

Jan AI Integration

LM Studio Integration

OpenRouter Integration

Provider Auto-Detection (no-config first run)

When you run praisonai run without setting --model or a model: key in config.yaml, PraisonAI inspects which supported provider credential is present in your environment and picks a provider-appropriate default — so a user whose only key is ANTHROPIC_API_KEY no longer gets an OpenAI auth error on first run.
Credential env varResolved default modelBase URL
OPENAI_API_KEYgpt-4o-minihttps://api.openai.com/v1
ANTHROPIC_API_KEYanthropic/claude-3-5-sonnet-latesthttps://api.anthropic.com/v1
GEMINI_API_KEYgemini/gemini-1.5-flashhttps://generativelanguage.googleapis.com/v1beta
GOOGLE_API_KEYgoogle/gemini-1.5-flashhttps://generativelanguage.googleapis.com/v1beta
GROQ_API_KEYgroq/llama-3.3-70b-versatilehttps://api.groq.com/openai/v1
COHERE_API_KEYcohere/command-rhttps://api.cohere.ai/v1
OLLAMA_HOSTollama/llama3.2http://localhost:11434/v1
(none of the above)gpt-4o-minihttps://api.openai.com/v1
Precedence: the first credential in the table that is set wins. If multiple provider keys are set, the one listed first takes effect.
The same resolver drives implicit defaults for praisonai run, praisonai chat, praisonai init scaffolding, praisonai setup, and the bare-praisonai TUI launch — not just run.
An explicit --model <name> flag or a model: key in config.yaml always overrides auto-detection.

Primary vs Auxiliary Model

PraisonAI splits your model choice into two knobs:
KnobWhat it drivesConfigured via
modelThe agent’s own reasoning / tool-use turnsAgent(llm=...), [defaults].model
small_modelCheap internal calls (session titles, summarisation)[defaults].small_model
small_model falls back to model when unset, so single-provider (Anthropic, Ollama, on-prem) setups make zero unexpected third-party calls.
See Configuration File → Cheap auxiliary model for internal calls for full examples.

Supported Models for No Code

PraisonAI ChatPraisonAI CodePraisonAI (Multi-Agents)
LitellmLitellmBelow Models

Example agents.yaml

This uses Multi-Agents with Multi-LLMs.

How It Works

The Agent passes your llm value to the provider resolver, which routes the request to the matching model and returns the response.

Best Practices

Skip llm= on first runs. PraisonAI resolves a sensible default from whichever provider key is set — see Provider Auto-Detection.
Pass llm="gemini/gemini-1.5-flash-8b" or llm="anthropic/claude-3-5-sonnet-latest" to target a specific provider model.
Set provider keys in your shell or .env. Use api_key=None in llm_config so the SDK reads the environment variable.
Use a small fast model (gpt-4o-mini, gemini-1.5-flash) for routing and a larger model only where quality matters.

Quick Start

Run your first agent in a few lines.

Tools

Give models real actions with tools.