AI
Model guide
Which model to use when, what each one costs, and how to keep the AI bill small.
Enabling providers
A provider’s models appear in the AI node’s picker and in auto-routing only when the workspace has a key for it. Operators set these as server environment variables:
| Provider | Env var | Get a key |
|---|---|---|
| Anthropic (Claude) | ANTHROPIC_API_KEY | console.anthropic.com |
| OpenAI (GPT) | OPENAI_API_KEY | platform.openai.com |
| Google (Gemini) | GEMINI_API_KEY or GOOGLE_API_KEY | aistudio.google.com |
| DeepSeek | DEEPSEEK_API_KEY | platform.deepseek.com |
| xAI (Grok) | XAI_API_KEY | console.x.ai |
| Ollama (local) | OLLAMA_BASE_URL + OLLAMA_MODEL | ollama.com — free, private |
The catalog
Tier is DirectRouter’s capability judgment: 3 = frontier (hard reasoning), 2 = balanced workhorse, 1 = fast and cheap. Prices are USD per million tokens.
| Model | Provider | Tier | $/MTok in | $/MTok out | Context | Best for |
|---|---|---|---|---|---|---|
| Claude Fable 5 | anthropic | 3 | 10.00 | 50.00 | 1M | The hardest long-horizon reasoning and agentic work; premium price |
| Claude Opus 4.8 | anthropic | 3 | 5.00 | 25.00 | 1M | Deep reasoning, complex coding, autonomous agents |
| Gemini 3.1 Pro | gemini | 3 | 2.00 | 12.00 | 1M | Multimodal flagship; long-document and cross-source analysis |
| Grok 4 | xai | 3 | 3.00 | 15.00 | 256K | Strong reasoning; real-time X/web data on xAI’s platform |
| GPT-5.1 | openai | 3 | 1.25 | 10.00 | 400K | Flagship generalist; strong instruction following and tool use |
| DeepSeek Reasoner | deepseek | 3 | 0.28 | 0.42 | 128K | Frontier-class reasoning at commodity prices |
| Claude Sonnet 5 | anthropic | 2 | 3.00 | 15.00 | 1M | Everyday coding and agentic workloads |
| Gemini 3 Flash | gemini | 2 | 0.50 | 3.00 | 1M | Fast and cheap with a huge context |
| GPT-5 mini | openai | 2 | 0.25 | 2.00 | 400K | Cheap mid-tier for structured tasks |
| Grok 4 Fast | xai | 2 | 0.20 | 0.50 | 2M | Very cheap, 2M-token context — whole-corpus prompts |
| DeepSeek Chat | deepseek | 2 | 0.28 | 0.42 | 128K | General chat and code at very low cost |
| Claude Haiku 4.5 | anthropic | 1 | 1.00 | 5.00 | 200K | Fast classification, extraction, short chat |
| GPT-5 nano | openai | 1 | 0.05 | 0.40 | 400K | Bulk classification and routing at minimal cost |
| Gemini 3.1 Flash-Lite | gemini | 1 | 0.25 | 1.50 | 1M | High-volume, latency-sensitive pipelines |
| Ollama (your model) | ollama | 1 | 0 | 0 | ~128K | Free, fully private — data never leaves your hardware |
When to use which model
- Agentic workflows, multi-step tool use, hard code changes → Claude Opus 4.8; Claude Fable 5 when the task is genuinely at the frontier and worth 2× Opus pricing.
- Everyday generation (summaries, drafts, rewriting, data-to-text) → Claude Sonnet 5, GPT-5 mini or Gemini 3 Flash. Most workflow volume belongs here.
- Hard reasoning on a budget → DeepSeek Reasoner — the same task on Opus costs ~60× more. Use Opus when prose quality or provider trust outweighs price.
- Very long inputs (contracts, logs, whole repos) → Grok 4 Fast (2M) or the 1M-context Gemini/Claude models. You pay per input token: a 1M-token prompt on Opus is ~$5 per call.
- Bulk, cheap steps (classify, tag, extract, yes/no gates) → GPT-5 nano, Gemini Flash-Lite or Claude Haiku. Never spend flagship money on classification.
- Sensitive data → Ollama locally (
privacy: local), or pin a provider whose data-processing terms you have reviewed. DeepSeek is a PRC-based service — check compliance before routing customer data there.
Cost optimization playbook
- Let auto mode work. Not sending easy tasks to expensive models routinely cuts spend 10–50× versus “always the flagship”.
- Set the budget cap where quality is negotiable — e.g. cap at
2.5$/MTok out to stay in the Flash/mini class regardless of the classifier. - Watch
costUsd— every AI run reports model, tokens and dollars; measure before optimizing. - Trim the prompt. Pass fields, not blobs:
{{$json.text}}, not{{$json}}. - Bound the output with max tokens — output tokens cost 4–8× input on most models.
- Split pipelines by tier: a cheap model filters, the flagship handles survivors. Two nodes are often 10× cheaper than one.
- Use local models for volume — Ollama costs $0, ideal for dev and test runs so iterating never burns paid tokens.
- Keep ≥2 providers configured — fallbacks turn outages into slightly different model choices instead of failed executions.
Customizing the catalog
Prices drift and providers ship new models — the catalog is data, not code. Operators override it without a code change via the DIRECTOS_MODEL_CATALOG_JSON environment variable:
[
{
"id": "gpt-5.2",
"label": "GPT-5.2",
"provider": "openai",
"tier": 3,
"inputCostPerMTok": 1.25,
"outputCostPerMTok": 10,
"contextWindow": 400000,
"bestFor": "..."
}
]