Harness Control
The orchestration layer Claude Code does not ship
Keep Claude Code or Hermes. Add HTTP headers. Our gateway routes plan work to frontier models, bulk work to cheap tiers, enforces session budgets, compacts long context — all verifiable via X-Harness-* response headers.
For Claude Code power users
What Anthropic direct cannot do — Harness does server-side
Claude Code is a great terminal agent. ModelAPI Harness is orchestration software on our gateway — it does not replace Claude Code, but auto-picks models, enforces budgets, and compacts long context. All features below are live and verifiable via response headers.
You keep Claude Code
Set ANTHROPIC_BASE_URL to api.aimodelapi.ai and add x-harness-profile: claude-code-optimal.
Harness reads each request
"Run all tests" → bulk tier → nexus/cheapest-west. Architecture question → plan tier → nexus/best-reasoning.
You see the decision
X-Harness-Task and X-Harness-Model tell you which model ran — auditable, billable at official rates.
| Capability | Anthropic direct | Claude Code + Harness |
|---|---|---|
Multi-vendor models in one agent session Opus for plan, DeepSeek Flash for bulk — automatic via tiers | No | Yes |
Server-side task tier routing (plan / bulk / compress) Rules + optional hybrid LLM classifier on every request | No | Yes |
Session USD spend cap with HTTP 429 Redis-backed; claude-code-optimal default $50/session | No | Yes |
Auto context compaction before expensive calls Server summarizes older turns; non-streaming requests today | Partial | Yes |
Live model aliases (nexus/*, claude-sonnet-latest) | No | Yes |
Provider prompt-cache optimization (Bedrock) Dashboard shows cacheRead / cacheSavingsUsd | Partial | Yes |
Exact-match response cache Non-stream, temp ≤ 0.1, no tools; X-ModelAPI-Cache header | No | Yes |
Agent memory consolidate API POST /v1/harness/memory/consolidate | No | Yes |
Transparent routing in response headers X-Harness-Model, X-Harness-Task, X-Harness-Classifier | No | Yes |
Native Claude Code UX (queue, steer, IDE) Keep Claude Code — point ANTHROPIC_BASE_URL at ModelAPI + Harness headers | Yes | Partial |
Honest notes: Harness does not change Claude Code's client UI. Auto-compact and response cache apply mainly to non-streaming calls today. "Response cache" is exact payload match, not embedding similarity. Hybrid cost ($2.20/M output at 5% Opus / 95% cheap) is a typical agent workload estimate — your mix may differ.
30 seconds: how bulk tasks get cheaper
Demo: bulk task routes from nexus/best-reasoning to nexus/cheapest-west. Your live API headers are the source of truth.
Agent cloud · not a token relay
Harness Control: orchestration for agents
ModelAPI sells an agent service: tiered task routing, session budgets, compaction, and cache optimization. Model calls are billed at upstream channel rates — you buy orchestration, not a simple token hop.
Harness Control
Server-side agent orchestration: tiered task routing (plan / bulk / compress), session USD budgets, auto context compaction, and prompt-cache optimization.
Nexus Routing Engine
Cost-, latency-, and capability-aware model selection via nexus/* aliases. Live catalog resolution — your code stays stable as frontier SKUs update.
Multi-tier Fallback
Profile-driven fallbacks (e.g. Opus → Sonnet → nexus/cheapest-west) with provider health checks — intelligent agent routing.
Response cache & Memory API
Exact-match response cache for repeated non-stream calls; transient memory consolidate API for Hermes/OpenClaw agent workflows.
curl https://api.aimodelapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-ama-..." \
-H "x-harness-profile: claude-code-optimal" \
-H "x-harness-session-id: my-project-1" \
-H "x-harness-auto-compact: true" \
-d '{"model":"nexus/best-coding","messages":[...]}'Response headers X-Harness-Profile / X-Harness-Model / X-Harness-Task expose routing decisions. See /docs#harness and integrations.
Subscription vs raw API vs ModelAPI + Harness
Claude Code Max is ~$100/mo for Opus-level usage; raw API bills per token and agents can burn $70+ overnight. Harness adds bulk routing, session budgets, and stop-loss so pay-as-you-go stays competitive — we do not claim it is always cheaper than a subscription, but it prevents runaway spend.
| Factor | Claude subscription | Raw API (no Harness) | ModelAPI + Harness |
|---|---|---|---|
| Monthly cost predictability | Fixed ~$100/mo (Max tier) | Unbounded — users report $70+ in one night | Session budget + hourly cap → HTTP 429 |
| Bulk task routing | All tasks on subscription model | You pick model per request — easy to overpay | Auto bulk → nexus/cheapest-west |
| Stop-loss on runaway agents | Usage caps within Anthropic product | Account spend cap only (optional) | Per-session USD budget + alerts |
| Multi-vendor models | Anthropic models only | Yes — but you manage routing | Plan on reasoning · bulk on cheap · one API key |
| Honest fit | Best if you stay within Max limits | Best with discipline + monitoring | Pay-as-you-go competitive when Harness is on |
Image & Video Generation — Cost Awareness
User feedback: image/video work is the top token consumer. ModelAPI routes multimodal models via Chat Completions; dedicated media APIs vary by provider. Best practices below — honest about what ships today.
Image generation via chat models
Models with vision/output capabilities (e.g. Gemini, GPT-4o) can return images in agent workflows. Billed as chat completion tokens — often the highest token burn in a session.
Video & media — job-based workflow
Dedicated video generation APIs are provider-specific. We recommend async job patterns: submit → poll → download. Set a Harness session budget before long media runs.
Harness budget tips for media
Use x-harness-session-id + x-harness-budget-usd on every media batch. Enable stop-loss hourly cap in the dashboard. Route planning to reasoning models, asset prep to bulk tier.
Verify it yourself
Send a bulk-style prompt with x-harness-profile: claude-code-optimal. Expect X-Harness-Task: bulk and a cheaper X-Harness-Model.
curl -i https://api.aimodelapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-ama-..." \
-H "x-harness-profile: claude-code-optimal" \
-H "x-harness-session-id: verify-1" \
-H "Content-Type: application/json" \
-d '{"model":"nexus/best-reasoning","messages":[{"role":"user","content":"Run tests on all files and lint"}],"max_tokens":256}'Full integration guides