Build

Routing

ModGate can pick the best upstream channel for a request based on price, latency, region, or a fallback chain you define.

Modes

  • cheapest — minimum cost among eligible channels.
  • fastest — lowest p50 TTFT in the last 5 minutes.
  • balanced (default) — weighted score across cost, latency, and recent error rate.
  • pinned — always use the exact channel set on the key.

Per-request override

curl https://api.modgat.com/v1/chat/completions \
  -H "Authorization: Bearer $FORGE_KEY" \
  -H "X-ModGate-Route: cheapest" \
  -d '{ "model": "claude-4.5-sonnet", "messages": [...] }'

Fallback chains

Provide a comma-separated list of model IDs. ModGate tries each in order and falls through on 429 / 5xx / timeout.

X-ModGate-Route: openai/gpt-5,claude-4.5-sonnet,gemini-3-pro

Routing rules in the console

Open Channels → Routes in the console to author rules declaratively — match by model glob, region, or header, then choose a channel and a fallback chain. Rules are evaluated top-down.