Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Configure where your agents send LLM requests using environment variables.

Quick Start

1

Use OpenAI (default)

Set your OpenAI API key and create an agent:
import os
from praisonaiagents import Agent

os.environ["OPENAI_API_KEY"] = "your-api-key"

agent = Agent(
    name="Research Assistant",
    instructions="You are a helpful research assistant"
)

result = agent.start("Explain quantum computing in simple terms")
2

Use Ollama locally

Point to your local Ollama instance:
import os
from praisonaiagents import Agent

os.environ["OPENAI_BASE_URL"] = "http://localhost:11434/v1"
os.environ["MODEL_NAME"] = "llama3"

agent = Agent(
    name="Local Assistant",
    instructions="You are a helpful assistant running locally"
)

result = agent.start("What are the benefits of local LLMs?")
3

Use a custom proxy / LiteLLM

Configure any OpenAI-compatible proxy:
import os
from praisonaiagents import Agent

os.environ["OPENAI_BASE_URL"] = "https://your-proxy/v1"
os.environ["OPENAI_API_KEY"] = "your-proxy-key"
os.environ["MODEL_NAME"] = "claude-3-sonnet"

agent = Agent(
    name="Proxy Assistant",
    instructions="You are an assistant using a proxy endpoint"
)

result = agent.start("Compare different AI models")

How It Works


Environment Variables

VariablePurposePrecedence
OPENAI_BASE_URLLLM endpoint URL (highest priority)1
OPENAI_API_BASELLM endpoint URL (legacy compat)2
OLLAMA_API_BASEOllama endpoint URL3
MODEL_NAMEModel name (highest priority)1
OPENAI_MODEL_NAMEModel name (legacy compat)2
OPENAI_API_KEYAPI key (no fallback)

Defaults

SettingDefault Value
Modelgpt-4o-mini
Base URLhttps://api.openai.com/v1
API KeyNone

Common Patterns

Run against Ollama

export OPENAI_BASE_URL="http://localhost:11434/v1"
export MODEL_NAME="llama3"
python your_agent.py

Run against a corporate OpenAI proxy

export OPENAI_BASE_URL="https://corporate-proxy.company.com/v1"
export OPENAI_API_KEY="your-corporate-key"
export MODEL_NAME="gpt-4"
python your_agent.py

Use Azure OpenAI / Bedrock via LiteLLM

export OPENAI_BASE_URL="https://your-litellm-proxy/v1"
export OPENAI_API_KEY="your-litellm-key"
export MODEL_NAME="azure/gpt-4"
python your_agent.py

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.
# This skips OPENAI_BASE_URL and tries OPENAI_API_BASE
export OPENAI_BASE_URL=""
export OPENAI_API_BASE="https://proxy.com/v1"

# This uses OPENAI_BASE_URL
unset OPENAI_BASE_URL
export OPENAI_API_BASE="https://proxy.com/v1"
Create a .env file in your project root for local development:
# .env
OPENAI_BASE_URL=http://localhost:11434/v1
MODEL_NAME=llama3
# OPENAI_API_KEY not needed for Ollama
Load it in your Python code:
from dotenv import load_dotenv
load_dotenv()

from praisonaiagents import Agent
# Environment variables are now loaded
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.

LLM Configuration

Complete LLM configuration options

Models

Supported models and providers