Dashboard/Documentation

API Documentation

Const Router is a high-performance universal AI gateway providing drop-in access to 14 frontier models through standard OpenAI and Anthropic API specifications.

Base URL: https://router.const.web.id/v1OpenAI Spec: 2024-10Anthropic Messages Spec

Quickstart

Calling models through Const Router requires only two changes to standard client code: point the base URL to https://router.const.web.id/v1 and supply your Const API key.

Python SDK Example
from openai import OpenAI

client = OpenAI(
    base_url="https://router.const.web.id/v1",
    api_key="const_live_YOUR_KEY",
)

response = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Explain Virtual Combos in two sentences."}],
)
print(response.choices[0].message.content)

Authentication

Every inference request requires an active API key passed in the Authorization header with the Bearer prefix, or via x-api-key.

# Header syntax

Authorization: Bearer const_live_xxxxxxxxxxxxxxxxxxxxxxxx

Keys are revealed once upon creation. Invalid, disabled, or daily-capped keys are rejected with HTTP 401/403 before executing upstream model calls.

Models & Free Allowance

Const Router operates two billing tiers: Free Tier and Paid Wholesale.

Weekly Free Allowance

7,000,000

Tokens per 7-day cycle. Applies automatically to models marked :free.

Paid Wholesale

Per-Token

Metered down to fractions of a cent with up to 91% discount against official provider rates. No subscriptions.

Eligible Free Tier IDs:

deepseek-v4.1-flash:freeqwen-3.8-omni-flash:freeglm-5.3-flash:free

SDKs & Agent Setup

Use Const Router with official developer CLIs and autonomous agent frameworks:

Claude Code CLI (Anthropic Spec)

export ANTHROPIC_BASE_URL="https://router.const.web.id"
export ANTHROPIC_API_KEY="const_live_YOUR_KEY"
claude

Cursor / Cline / Roo Code / OpenCode

Set Provider to OpenAI Compatible, Base URL to https://router.const.web.id/v1, and enter your Const API key.

Chat Completions

Standard endpoint: POST /v1/chat/completions. Supports streaming, function/tool calling, structured JSON output, vision inputs, and reasoning controls.

cURL Payload
curl https://router.const.web.id/v1/chat/completions \
  -H "Authorization: Bearer const_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [
      {"role": "system", "content": "You are a concise engineering assistant."},
      {"role": "user", "content": "Compare quicksort vs mergesort cache locality."}
    ],
    "temperature": 0.2,
    "max_tokens": 1024
  }'

Reasoning Effort

Parameter Guide

For reasoning and thinking models (such as DeepSeek R1, GLM thinking, and OpenAI reasoning architectures), pass the reasoning_effort parameter to modulate internal thought token budgets before producing output.

LevelBehaviorRecommended For
"low"Minimal internal chain-of-thought tokens. Lowest latency.Simple code edits, quick lookups, high-concurrency bots
"medium"Balanced reasoning budget (default setting).General debugging, unit test synthesis, refactoring
"high"Extended internal exploration and self-correction cycles.Complex algorithmic proofs, architecture planning, multi-file refactors
"max"Maximal thinking depth up to context boundaries.Mission-critical bug audits and difficult logic puzzles
Reasoning Request Example
from openai import OpenAI

client = OpenAI(
    base_url="https://router.const.web.id/v1",
    api_key="const_live_YOUR_KEY",
)

# Pass reasoning_effort parameter directly
response = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Design an idempotent distributed lock with redis."}],
    reasoning_effort="high",
)

print(response.choices[0].message.content)

Streaming (Server-Sent Events)

Enable SSE by setting stream: true. Stream frames are passed through directly from upstream without proxy buffering delays. The final terminal chunk delivers exact token telemetry:

data: {"choices": [{"delta": {"content": "..."}}]}
...
data: {"usage": {"prompt_tokens": 42, "completion_tokens": 128}}
data: [DONE]

Tool Calling & JSON Mode

Const Router supports OpenAI standard function schemas via tools and tool_choice. For structured JSON outputs without tools, pass:

"response_format": { "type": "json_object" }

Virtual Combos & Automatic Failover

Virtual Combos allow grouping multiple upstream models under a single slug (model: "combo/my-coding-stack"). When your primary model returns HTTP 429 (rate limited), 503 (out of capacity), or high latency, Const Router automatically fails over to the next candidate model in the chain before replying to the client.

Response Header Telemetry:

X-Const-Combo-Selected-Model identifies the actual model that generated the completion.

Available Endpoints

POST
/v1/chat/completions

OpenAI-compatible chat, streaming, tool calls, and user combos.

Chat completions
GET
/v1/models

Public models; authenticated requests also include your active combos.

Model catalog
POST
/v1/audio/transcriptions

Speech to text using Whisper. Charged per audio minute.

Audio transcription
POST
/v1/search

Research or deep research. Charged per search request.

Web search
POST
/v1/fetch

Authenticated extraction of public web pages.

Fetch web content
POST
/v1/transcript

Authenticated caption extraction from a public YouTube video.

YouTube transcript

Errors & Retries

Standard HTTP error codes are preserved:

CodeMeaningAction
400Malformed request or unsupported parameterCheck request JSON payload
401 / 403Invalid, revoked, or model-restricted keyGenerate active key in Dashboard → API Keys
402Credit balance depleted or weekly free quota exceededTop up credit or switch to free model
429Rate limit reachedRetry with exponential backoff or use Combos
502 / 503Upstream provider outageRouter failover automatically engages

Per-Token Metering & Ledger

Every settled request emits an X-Const-Cost header with the exact micro-cost in USD deducted from your balance. Failed upstream requests are never billed.