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. 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.

Keyless local-first fallback (no env vars set)

If no cloud provider key is set and a local OpenAI-compatible endpoint answers on http://127.0.0.1:11434 (or wherever OPENAI_BASE_URL / OLLAMA_HOST points), PraisonAI uses that local server as the zero-config default — the first praisonai run "..." just works before you configure anything.
Precedence (first match wins):
  1. --model <name> on the command line.
  2. Any cloud provider key from the table above.
  3. A reachable local endpoint at OPENAI_BASE_URLOLLAMA_HOSThttp://127.0.0.1:11434.
  4. gpt-4o-mini fallback.
Detection is timeout-bounded (~150 ms) and cached briefly, so the first-run hot path stays fast when nothing is listening. Cloud keys always win — the local probe is skipped entirely when any cloud key is set.
Detection recognises two shapes at the local server: See Local Models for the full guide.
An explicit --model <name> flag or a model: key in config.yaml always overrides auto-detection.
No cloud key at all? If Ollama (or any OpenAI-compatible local server) is running, PraisonAI will use it — no API key and no config. See Keyless Local-First Run.

Primary vs Auxiliary Model

PraisonAI splits your model choice into two knobs: small_model falls back to model when unset, so single-provider (Anthropic, Ollama, on-prem) setups make zero unexpected third-party calls — the auxiliary calls (titles, compaction, guardrails) all stay on your configured provider.
See Configuration File → Cheap auxiliary model for internal calls for full examples.

Supported Models for No Code

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.