Documentation Index
Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Create a new API token for calling AI model APIs.
The /api/token/* endpoints are mainly for Crazyrouter dashboard automation around API key management. They require a user access token plus the New-Api-User header, and are not the normal interface for sk-xxx model calls.
Authentication
This endpoint requires user-side authentication:
Authorization: Bearer your_access_token
New-Api-User: 1
Request Parameters
Token name for easy identification
Initial quota in internal quota units. If set to 0, use it together with unlimited_quota
unlimited_quota
boolean
по умолчанию:"false"
Whether the token has unlimited quota
Expiration timestamp. -1 means never expires
model_limits_enabled
boolean
по умолчанию:"false"
Whether to enable a model whitelist
Model restriction config as a string, usually a JSON string such as ["gpt-5.4","claude-sonnet-4-6"]
IP whitelist string. You can pass a single IP or multiple IPs separated by newlines
Token group. It must be a group the current user is allowed to use
The current implementation only returns a success state after creation:
{
"success": true,
"message": ""
}
Code Examples
import json
import requests
headers = {
"Authorization": "Bearer your_access_token",
"New-Api-User": "1",
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0"
}
response = requests.post(
"https://crazyrouter.com/api/token/",
headers=headers,
json={
"name": "Production",
"remain_quota": 100000,
"unlimited_quota": False,
"expired_time": -1,
"model_limits_enabled": True,
"model_limits": json.dumps(["gpt-5.4", "claude-sonnet-4-6"]),
"allow_ips": "203.0.113.10"
}
)
print(response.json())
The current create endpoint does not return the full generated key in the response. If your workflow requires copying the full token immediately, prefer creating it from the console UI and saving it there.