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.

1

You keep Claude Code

Set ANTHROPIC_BASE_URL to api.aimodelapi.ai and add x-harness-profile: claude-code-optimal.

2

Harness reads each request

"Run all tests" → bulk tier → nexus/cheapest-west. Architecture question → plan tier → nexus/best-reasoning.

3

You see the decision

X-Harness-Task and X-Harness-Model tell you which model ran — auditable, billable at official rates.

CapabilityAnthropic directClaude Code + Harness
Multi-vendor models in one agent session
Opus for plan, DeepSeek Flash for bulk — automatic via tiers
NoYes
Server-side task tier routing (plan / bulk / compress)
Rules + optional hybrid LLM classifier on every request
NoYes
Session USD spend cap with HTTP 429
Redis-backed; claude-code-optimal default $50/session
NoYes
Auto context compaction before expensive calls
Server summarizes older turns; non-streaming requests today
PartialYes
Live model aliases (nexus/*, claude-sonnet-latest)
NoYes
Provider prompt-cache optimization (Bedrock)
Dashboard shows cacheRead / cacheSavingsUsd
PartialYes
Exact-match response cache
Non-stream, temp ≤ 0.1, no tools; X-ModelAPI-Cache header
NoYes
Agent memory consolidate API
POST /v1/harness/memory/consolidate
NoYes
Transparent routing in response headers
X-Harness-Model, X-Harness-Task, X-Harness-Classifier
NoYes
Native Claude Code UX (queue, steer, IDE)
Keep Claude Code — point ANTHROPIC_BASE_URL at ModelAPI + Harness headers
YesPartial

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

Request

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.

Harness request exampleAlgorithm-layer headers
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.

FactorClaude subscriptionRaw API (no Harness)ModelAPI + Harness
Monthly cost predictabilityFixed ~$100/mo (Max tier)Unbounded — users report $70+ in one nightSession budget + hourly cap → HTTP 429
Bulk task routingAll tasks on subscription modelYou pick model per request — easy to overpayAuto bulk → nexus/cheapest-west
Stop-loss on runaway agentsUsage caps within Anthropic productAccount spend cap only (optional)Per-session USD budget + alerts
Multi-vendor modelsAnthropic models onlyYes — but you manage routingPlan on reasoning · bulk on cheap · one API key
Honest fitBest if you stay within Max limitsBest with discipline + monitoringPay-as-you-go competitive when Harness is on
Shipped today Not a token relay

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.

What exists today: POST /v1/images/generations is live (Seedream, Qwen/Wan, GPT Image 2, Gemini Image). See /models?capability=image.Model catalog →

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