Browse Documentation

Integration Docs

Buyers integrate against the router with one API key and one route alias. These examples show the buyer-facing request surface.

Supported models

AINOGAP currently supports four Claude models. All requests use the Anthropic Messages API format.

Haiku 4.5
claude-haiku-4-5
Sonnet 4.6
claude-sonnet-4-6
Opus 4.6
claude-opus-4-6
Opus 4.7
claude-opus-4-7

Request example

Anthropic Messages API format. Select a route via the URL path.

POST /<route-alias>/v1/messages
x-api-key: rk_xxx
anthropic-version: 2023-06-01
Content-Type: application/json

{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "messages": [
    { "role": "user", "content": "Hello" }
  ]
}
{
  "type": "message",
  "role": "assistant",
  "content": [
    { "type": "text", "text": "Hello! How can I help?" }
  ],
  "usage": {
    "input_tokens": 12,
    "output_tokens": 8,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}

Select a route from the URL path (for example /claude-fast/v1/messages). The buyer ledger meters five token classes: uncached input, output, cache write (5m), cache write (1h), and cache read. Each class is billed independently and debited from your prepaid USDC balance in real time.

Token metering breakdown

Every request is metered across five token classes. Understanding cache tokens unlocks meaningful cost savings.

Token classes:
• input      — uncached input tokens (prompt)
• output     — generated output tokens
• cache_w5m  — cache write tokens (5-minute TTL)
• cache_w1h  — cache write tokens (1-hour TTL)
• cache_read — cache read tokens (cache hit)

cost = Σ(tokens_in_class × unit_price_for_class)
Example metering for a cached request:
{
  "uncachedInputTokens": 50,
  "cacheWrite5mTokens": 200,
  "cacheWrite1hTokens": 0,
  "cacheReadTokens": 1500,
  "outputTokens": 120,
  "buyerChargeUsdMicros": 4200
}

Cache reads are dramatically cheaper than uncached input. Apply prompt caching to repeated context to cut costs. Cache writes are billed only once per cache creation.

Key rotation

Rotate immediately from the buyer console or admin panel if a key is exposed.

POST /buyer/rotate-api-key
Authorization: Bearer <session_token>
{
  "item": {
    "buyerId": "buyer_abc",
    "routeApiKey": "rk_new_xxx"
  }
}

The old key is revoked instantly. Copy the new key now — it is shown only once. Your browser session is updated automatically.