DEVELOPER DOCS

KOPI TokenMax
One API, 50+ models

An OpenAI-compatible unified model gateway: one key, one endpoint, smart-routed across 50+ LLMs with automatic multi-upstream failover.

50+
Models connected
5
Failover chain
100%
OpenAI compatible
300 RPM
Default rate limit

Get started in 3 steps

01
Get an API key

Sign up, add a payment method, then claim your key on the onboarding page (5M free tokens included).

02
Point your endpoint

Set base URL to https://kopiaiagent.com/v1 — any OpenAI-SDK-compatible client just works.

03
Pick a model & call

Recommended: kopi-o (daily) / kopi-flash (fastest) / kopi-o-pro (flagship). Switch per task anytime.

Models & pricing

Prices per million tokens (USD). “Metered” means real-time pricing — query /v1/pricing.

ModelTierContextInput $/MOutput $/MNotes
kopi-oRecommendedT2 Standard262K$0.30$0.30Daily driver · reasoning + multimodal
kopi-flashT3 Fast128K$0.30$0.30Fastest · everyday chat
kopi-o-proT1 Flagship1M$0.30$0.30Flagship reasoning · strongest
kopi-o-flashT3 Fast262K$0.80$2.00Fast & lightweight
kopi-qwenT2 Standard1M$1.25$5.00Ultra-long context
kopi-kimiT2 Standard262K$0.74$2.50Code specialist
kopi-geminiT3 Fast1M$1.50$5.00Fast multimodal
kopi-gpt5T1 Flagship1M$5.00$15.00Strongest closed-source reasoning
kopi-opusT1 Flagship1M$7.00$35.00Deep analysis
kopi-ds-r1T2 Standard128KMeteredMeteredOpen reasoning · usage-based pricing

Code examples

Fully OpenAI Chat Completions compatible — just swap the base_url, no code changes.

curl · chat completions
curl https://bill.kopiagent.ai/v1/chat/completions \
  -H "Authorization: Bearer <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kopi-o",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 1024
  }'
python · openai sdk
from openai import OpenAI

client = OpenAI(
    api_key="<your_api_key>",
    base_url="https://bill.kopiagent.ai/v1",
)

response = client.chat.completions.create(
    model="kopi-o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
curl · streaming (SSE)
curl https://bill.kopiagent.ai/v1/chat/completions \
  -H "Authorization: Bearer <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kopi-flash",
    "messages": [{"role": "user", "content": "Hi"}],
    "stream": true
  }'
Smart routing & failover

TokenMax routes each request to the best-fit model; if an upstream times out, rate-limits or errors, it automatically falls through a 5-level chain — zero downtime, no client retries.

  • Smart routing Picks the cheapest capable model per task, cutting LLM spend significantly.
  • 5-level auto failover Falls back on 4xx/5xx, timeouts, 429 rate limits and empty responses.
  • Quota & security Keys stored as SHA256 hashes; per-client token quotas (402 over limit); 300 RPM default.

OpenAI compatibility matrix

  • Chat Completions✅ Fullmessages, stream, max_tokens, temperature, tools — all supported
  • Streaming✅ FullSSE format, ends with data: [DONE]
  • Vision✅ Supportedimage_url in content array
  • Function calling / Tools✅ Supportedtool_calls / function calling
  • Audio TTS✅ Available/v1/audio/speech (24kHz WAV), STT in progress
  • Image generation✅ Available/v1/images/generations
  • Embeddings⏳ Coming soonOn the roadmap

Get your API key

Sign up to start — 5,000,000 free tokens after adding a payment method.

Start for free

or reach us at contact@kopiaiagent.com