Skip to content

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_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)

{
  "qwen": {
    "type": "qwen_agent",
    "model": "qwen2.5:32b",
    "base_url": "http://localhost:11434"
  }
}

Requires Ollama running locally.

Getting API Keys

Claude (Anthropic)

  1. Go to console.anthropic.com
  2. Create an account
  3. Navigate to API Keys
  4. Create a new key
  5. Copy to backends.json

Gemini (Google)

  1. Go to aistudio.google.com
  2. Sign in with Google account
  3. Click "Get API Key"
  4. Create key for new project
  5. Copy to backends.json

OpenAI

  1. Go to platform.openai.com
  2. Create an account
  3. Navigate to API Keys
  4. Create a new key
  5. Copy to backends.json

Mistral

  1. Go to console.mistral.ai
  2. Create an account
  3. Navigate to API Keys
  4. Create a new key
  5. 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:

"newsletter_filter": {
  "ai": "gemini",
  "description": "Simple email filtering"
}

Use Local Models for Privacy

For sensitive data, use Ollama:

"process_contracts": {
  "ai": "qwen",
  "description": "Analyze confidential documents"
}

Limit Context

Use knowledge patterns to reduce tokens:

"create_offer": {
  "ai": "claude_sdk",
  "knowledge": "products|pricing"
}

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:

  1. Tool responses pass through anonymization
  2. Personal data replaced with placeholders
  3. AI sees [PERSON_1] instead of real names
  4. When AI uses placeholders, they're de-anonymized

Configure exceptions in system.json:

"anonymization_proxy": {
  "no_anonymize_output": ["delete_email"],
  "no_deanonymize_input": ["open_url"]
}