LLM Providers
Configure which AI model powers your agent
Choose the AI model that powers your agent – OpenAI, Anthropic, local models, and more.
Quick Start
- Use Default Model
rust use praisonai::Agent; // Uses gpt-4o-mini by default let agent = Agent::new() .name("Assistant") .instructions("You are helpful") .build()?; - Choose a Model
rust use praisonai::Agent; let agent = Agent::new() .name("Assistant") .model("gpt-4o") // or "claude-3-opus", "ollama/llama3" .build()?; - Custom API Endpoint
rust use praisonai::Agent; let agent = Agent::new() .name("Assistant") .model("llama3") .base_url("http://localhost:11434/v1") .build()?;
How It Works
Choosing a Model
| Model | Best For | Speed |
|---|---|---|
gpt-4o-mini | Fast responses, cost effective | ⚡ Fast |
gpt-4o | High quality, complex tasks | 🔵 Medium |
claude-3-opus | Long documents, analysis | 🔵 Medium |
ollama/llama3 | Privacy, offline use | 🟢 Local |
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
model | String | gpt-4o-mini | Model name |
api_key | String | From ENV | API key |
base_url | String | OpenAI default | API endpoint |
temperature | f32 | 0.7 | Randomness (0-1) |
max_tokens | u32 | None | Max response length |
Best Practices
Use environment variables for API keys
Set OPENAI_API_KEY instead of hardcoding keys.
Start with gpt-4o-mini
Fast and cheap – upgrade to gpt-4o only when needed.
Use local models for privacy
Ollama runs models locally with no data leaving your machine.