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:

ProviderEnv varGet a key
Anthropic (Claude)ANTHROPIC_API_KEYconsole.anthropic.com
OpenAI (GPT)OPENAI_API_KEYplatform.openai.com
Google (Gemini)GEMINI_API_KEY or GOOGLE_API_KEYaistudio.google.com
DeepSeekDEEPSEEK_API_KEYplatform.deepseek.com
xAI (Grok)XAI_API_KEYconsole.x.ai
Ollama (local)OLLAMA_BASE_URL + OLLAMA_MODELollama.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.

ModelProviderTier$/MTok in$/MTok outContextBest for
Claude Fable 5anthropic310.0050.001MThe hardest long-horizon reasoning and agentic work; premium price
Claude Opus 4.8anthropic35.0025.001MDeep reasoning, complex coding, autonomous agents
Gemini 3.1 Progemini32.0012.001MMultimodal flagship; long-document and cross-source analysis
Grok 4xai33.0015.00256KStrong reasoning; real-time X/web data on xAI’s platform
GPT-5.1openai31.2510.00400KFlagship generalist; strong instruction following and tool use
DeepSeek Reasonerdeepseek30.280.42128KFrontier-class reasoning at commodity prices
Claude Sonnet 5anthropic23.0015.001MEveryday coding and agentic workloads
Gemini 3 Flashgemini20.503.001MFast and cheap with a huge context
GPT-5 miniopenai20.252.00400KCheap mid-tier for structured tasks
Grok 4 Fastxai20.200.502MVery cheap, 2M-token context — whole-corpus prompts
DeepSeek Chatdeepseek20.280.42128KGeneral chat and code at very low cost
Claude Haiku 4.5anthropic11.005.00200KFast classification, extraction, short chat
GPT-5 nanoopenai10.050.40400KBulk classification and routing at minimal cost
Gemini 3.1 Flash-Litegemini10.251.501MHigh-volume, latency-sensitive pipelines
Ollama (your model)ollama100~128KFree, 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

  1. Let auto mode work. Not sending easy tasks to expensive models routinely cuts spend 10–50× versus “always the flagship”.
  2. 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.
  3. Watch costUsd — every AI run reports model, tokens and dollars; measure before optimizing.
  4. Trim the prompt. Pass fields, not blobs: {{$json.text}}, not {{$json}}.
  5. Bound the output with max tokens — output tokens cost 4–8× input on most models.
  6. Split pipelines by tier: a cheap model filters, the flagship handles survivors. Two nodes are often 10× cheaper than one.
  7. Use local models for volume — Ollama costs $0, ideal for dev and test runs so iterating never burns paid tokens.
  8. 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:

DIRECTOS_MODEL_CATALOG_JSON
[
  {
    "id": "gpt-5.2",
    "label": "GPT-5.2",
    "provider": "openai",
    "tier": 3,
    "inputCostPerMTok": 1.25,
    "outputCostPerMTok": 10,
    "contextWindow": 400000,
    "bestFor": "..."
  }
]