Skip to main content
Configure where your agents send LLM requests using environment variables, with automatic provider-specific routing for major LLM providers.
The user sets MODEL_NAME and provider keys; PraisonAI resolves the OpenAI-compatible endpoint before the agent runs.
As of PraisonAI 4.6.106, the endpoint resolver is available directly from praisonai-code:
The legacy path from praisonai.llm.env import ... still works via a sys.modules shim — both resolve to the same object.

Quick Start

1

Use OpenAI (default)

Set your OpenAI API key and create an agent:
2

Use Anthropic directly

No base URL needed - automatic provider routing:
3

Use Groq for fast inference

High-speed inference with automatic routing:
4

Use Google Gemini

Access Google’s latest models directly:

How It Works


Provider-specific defaults

If you set MODEL_NAME=anthropic/claude-3-5-sonnet, you do not need to set OPENAI_BASE_URL — the right base URL is picked automatically.
Provider keys do not cross-fallback. If you use anthropic/claude-3-5-sonnet and only OPENAI_API_KEY is set, the call has no credentials. This is a security fix, not a bug — it prevents accidental credential exposure.

Environment Variables

Defaults


Common Patterns

Run against Ollama

Run against a corporate OpenAI proxy

Use Anthropic directly

Use Groq for speed

Use Google Gemini

Use Azure OpenAI / Bedrock via LiteLLM


User Interaction Flow


Best Practices

OPENAI_BASE_URL is the standard OpenAI SDK environment variable and has the highest precedence. Use this for all new configurations rather than the legacy OPENAI_API_BASE.
An empty string value is skipped during resolution, and the next variable in precedence order is tried. To disable a variable, unset it completely rather than setting it to an empty string.
Create a .env file in your project root for local development:
Load it in your Python code:
For realtime features, WebSocket URLs are auto-derived from HTTP URLs. The system automatically:
  • Converts https:// to wss://
  • Strips /v1 suffix to avoid /v1/v1/realtime
  • Appends the appropriate realtime path
You only need to set OPENAI_BASE_URL - the realtime endpoint is handled automatically.

AutoGen Config List

Build an AutoGen-style config_list from the resolved endpoint

Standalone LLM Modules

All LLM modules available without the wrapper package

LLM Configuration

Complete LLM configuration options

Models

Supported models and providers

Provider Pages

Anthropic

Claude models and configuration

Groq

High-speed inference setup

Google

Gemini models and API access

Cohere

Language model configuration

OpenRouter

Multi-provider router setup

Ollama

Local model deployment
C7 note: As of PR #2550, the tool-discovery pipeline (tool_resolver), safe loader (_safe_loader), framework probes (_framework_availability), and plugin registry (tool_registry) also moved to praisonai_code — completing the same C7 arc as LLM config. See Tool Discovery Order and Local Tools Loading.