AI Backends¶
Configure AI providers for DeskAgent.
Supported Backends¶
| Backend | Type | Description | Cost |
|---|---|---|---|
claude_sdk | Claude Agent SDK | Recommended, with anonymization | $3/$15 per 1M tokens |
gemini | Google Gemini | 60% cheaper, 1M context | $1.25/$10 per 1M tokens |
openai | OpenAI GPT | gpt-4o, gpt-4o-mini | $2.50/$10 per 1M tokens |
mistral | Mistral API | OpenAI-compatible, mistral-large | $2/$6 per 1M tokens |
claude | Claude CLI | Claude Code CLI | $3/$15 per 1M tokens |
qwen | Ollama | Local, free | Free |
Configuration¶
Edit config/backends.json:
Claude (Recommended)¶
{
"claude_sdk": {
"type": "claude_agent_sdk",
"api_key": "sk-ant-api03-...",
"model": "claude-sonnet-4-20250514",
"permission_mode": "acceptEdits",
"use_anonymization_proxy": true
}
}
Options:
| Option | Values | Description |
|---|---|---|
permission_mode | default, acceptEdits, bypassPermissions | Tool approval mode |
use_anonymization_proxy | true/false | Enable PII protection |
Gemini¶
{
"gemini": {
"type": "gemini_adk",
"api_key": "AIza...",
"model": "gemini-2.5-pro",
"timeout": 300,
"temperature": 0.7,
"thinking_budget": 0
}
}
Options:
| Option | Default | Description |
|---|---|---|
temperature | 0.7 | Creativity (0.0-1.0) |
thinking_budget | 0 | Thinking tokens (0 = disabled) |
timeout | 300 | Request timeout in seconds |
OpenAI¶
{
"openai": {
"type": "openai_api",
"api_key": "sk-...",
"model": "gpt-4o",
"timeout": 120,
"temperature": 0.7,
"max_tokens": 4096,
"max_iterations": 30,
"pricing": { "input": 2.5, "output": 10 }
}
}
Models:
| Model | Context | Cost |
|---|---|---|
gpt-4o | 128K | $2.50/$10 per 1M tokens |
gpt-4o-mini | 128K | $0.15/$0.60 per 1M tokens |
Mistral¶
{
"mistral": {
"type": "openai_api",
"base_url": "https://api.mistral.ai/v1",
"api_key": "YOUR_MISTRAL_API_KEY",
"model": "mistral-large-latest",
"timeout": 120,
"temperature": 0.7,
"max_tokens": 4096,
"pricing": { "input": 2, "output": 6 }
}
}
Models:
| Model | Context | Cost |
|---|---|---|
mistral-large-latest | 128K | $2/$6 per 1M tokens |
mistral-small-latest | 128K | $0.20/$0.60 per 1M tokens |
codestral-latest | 256K | $0.30/$0.90 per 1M tokens |
Note: Mistral uses the same openai_api backend type with a custom base_url.
Local Models (Ollama)¶
Requires Ollama running locally.
Getting API Keys¶
Claude (Anthropic)¶
- Go to console.anthropic.com
- Create an account
- Navigate to API Keys
- Create a new key
- Copy to
backends.json
Gemini (Google)¶
- Go to aistudio.google.com
- Sign in with Google account
- Click "Get API Key"
- Create key for new project
- Copy to
backends.json
OpenAI¶
- Go to platform.openai.com
- Create an account
- Navigate to API Keys
- Create a new key
- Copy to
backends.json
Mistral¶
- Go to console.mistral.ai
- Create an account
- Navigate to API Keys
- Create a new key
- Copy to
backends.json
Assigning Backends to Agents¶
In config/agents.json:
"daily_check": {
"ai": "claude_sdk"
},
"simple_task": {
"ai": "gemini"
},
"local_analysis": {
"ai": "qwen"
}
Cost Optimization¶
Use Gemini for Simple Tasks¶
Gemini is 60% cheaper than Claude:
Use Local Models for Privacy¶
For sensitive data, use Ollama:
Limit Context¶
Use knowledge patterns to reduce tokens:
Permission Modes¶
default¶
Asks for approval before each tool call.
acceptEdits¶
Auto-approves file edits, asks for others.
bypassPermissions¶
Auto-approves all tool calls. Use with trusted agents only.
Anonymization Proxy¶
When use_anonymization_proxy: true:
- Tool responses pass through anonymization
- Personal data replaced with placeholders
- AI sees
[PERSON_1]instead of real names - When AI uses placeholders, they're de-anonymized
Configure exceptions in system.json: