DocumentationAPI ReferenceTool Integrations
StatusCommunityBlog ↗Get a key →

Build with flatkey

The official-model gateway. Route to 160+ real lab endpoints — text, video and audio — through one key, at 60–90% of list price, with a signed SLA behind every call.

Search the docs, or ask anything…⌘K
99.5%SIGNED SLA · TERMS
46BTOKENS / MONTH
160+OFFICIAL MODELS
2PROTOCOLS: OPENAI + ANTHROPIC

Start with one call

Most users start here: create a key in the console, change the base_url, send a request. Three lines, no infrastructure.

PythonJavaScriptcURL
from openai import OpenAI client = OpenAI(base_url="https://router.flatkey.ai/v1", api_key="sk-fk-…") r = client.chat.completions.create(model="gpt-5.5", messages=[{"role":"user","content":"hi"}])

Building with an AI agent? Fetch the full docs index at /llms.txt — every page also ships a plain-markdown mirror (.md).

Guides — the four things everyone asks

CODING AGENTS · CODEX CLI

Connect Codex

  1. One-liner: curl -fsSL https://flatkey.ai/install.sh | bash then pick Codex CLI when asked.
  2. Manual: in Codex choose API key login, base URL https://router.flatkey.ai/v1, paste your sk-fk-… key.
  3. Group returning 503? Switch the key to another group in the key editor (see Groups & routing below).
CODING AGENTS · ANTHROPIC PROTOCOL

Connect Claude Code / Cline

  1. Two environment variables:export ANTHROPIC_BASE_URL=https://router.flatkey.ai export ANTHROPIC_API_KEY=sk-fk-…Windows: setx ANTHROPIC_BASE_URL …
  2. Or persist in ~/.claude/settings.json:{"env": { "ANTHROPIC_BASE_URL": "https://router.flatkey.ai", "ANTHROPIC_API_KEY": "sk-fk-…" }}
  3. Run claude as usual. Cline: provider Anthropic, same base URL + key.
TEAMS · KEYS, GROUPS & QUOTAS

One key per person, one cap per key

  1. Create one key per teammate in Console → API Keys; set a monthly cap and optional model allowlist per key.
  2. Groups pick the routing pool, not the person: Standard = aggregated official channels (default); Economy = lowest-cost dedicated line. A key belongs to one group and can be moved anytime.
  3. Per-key spend, tokens by type and quota left: Usage & Logs or the ledger API.
BILLING · PRICES & CACHE, IN PLAIN TERMS

What each number means

PRICEMEANING
Input /Mper 1M prompt tokens sent
Output /Mper 1M tokens generated
Cached /Mre-sent prefix tokens, ~10% of input · cache lives 5–60 min per lab
  1. 30-day health = % of successful requests over the last 30 days, real production traffic.
  2. Failed requests (5xx) are never billed; failovers bill only the model that answered. Full SLA →

Community

Builders answering builders — routing configs, agent setups, model picks. The team reads everything; gateway-bench and the audit log are developed in the open.