1
Get Your API Key

Sign up and grab your key from the console. No Chinese phone number needed.

1. Go to https://www.tokencnn.com/register
2. Sign up with your email (no China phone needed)
3. Copy your API key from the Console → Token Management
2
Make Your First API Call

Use your API key with any OpenAI-compatible client. Replace sk-xxx with your key.

curl
Python
Node.js
# Replace sk-xxx with your actual API key
curl https://www.tokencnn.com/v1/chat/completions \
  -H "Authorization: Bearer sk-xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": false
  }'
# pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://www.tokencnn.com/v1",
    api_key="sk-xxx"  # Replace with your key
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
// npm install openai
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://www.tokencnn.com/v1',
  apiKey: 'sk-xxx'  // Replace with your key
});

const response = await client.chat.completions.create({
  model: 'deepseek-v4-flash',
  messages: [{role: 'user', content: 'Hello!'}]
});
console.log(response.choices[0].message.content);
3
Switch Models

Just change the model parameter. Popular choices:

deepseek-v4-flash qwen-3-max glm-5 gpt-4o claude-sonnet-4
4
Check Usage & Top Up

View your usage, API keys, and top up your balance in the Console. New users receive free credits.

API Reference

All endpoints are OpenAI-compatible. Base URL: https://www.tokencnn.com/v1

Endpoints

POST /v1/chat/completions Chat completions
GET /v1/models List available models
POST /v1/embeddings Create embeddings
Agent Identity

Give each of your AI agents a verified identity for tracking and cost control

What is it?

Add an X-Agent-Identity header to your API requests to label each call with the agent name, purpose, and owner. We pass it end-to-end so you can track which bots are consuming what.

Header Format

X-Agent-Identity: name=my-bot;purpose=production;owner=alice

Parameters: name (required), purpose, owner (optional).

cURL Example

curl https://www.tokencnn.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "X-Agent-Identity: name=my-agent;purpose=ci-cd;owner=dev" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}]}'

Best Practice

Use unique name per agent (e.g. chatbot-prod, data-pipeline, ci-tester) so you can distinguish usage by agent in your billing dashboard.

Agentic Trust — Full Stack

Four layers of agent-native governance — identity, cost control, audit, and trust scoring

🆔 Agent Identity Declaration

Every agent gets a verifiable identity via X-Agent-Identity header. Pass name=my-bot;purpose=prod;owner=alice with each request. We pass it end-to-end to the backend — no other gateway does this.

🛡️ Per-Agent Cost Circuit Breaker

Auto-disables agents when they exceed daily spending limits (default: 10,000 quota). Protect your budget from infinite loops and runaway bots. Anomalies trigger instant email alerts. Runs every 30 minutes.

📊 Full Audit Trail

Every API call gets logged with agent name, model, IP, token usage and request ID. Generate per-Agent compliance reports (CSV/JSON) covering last N days. Built for GDPR/SOC2 — full traceability from prompt to response. Audit report runs daily.

⚡ Behavior-Based Trust Scoring

Agents are scored 0-100 across 5 dimensions: volatility, frequency stability, model diversity, time-of-day patterns, and historical activity. Low-trust agents (<30) auto-downgraded with reduced limits; high-trust agents (>70) unlock priority routing. Check runs every 6 hours.

Tips

Common patterns and gotchas

Streaming

Add "stream": true to your request body for real-time token-by-token responses.

Max Tokens

Control response length with "max_tokens": 2048. Default varies by model.

Error 401

Invalid or missing API key. Check Authorization: Bearer sk-xxx header format.

Error 429

Rate limited. Wait and retry. Paid users get higher rate limits.

Error 500

Server error. Retry with exponential backoff. Usually transient.

Temperature

Adjust "temperature": 0.7 (0-2) for more creative or deterministic output.

Useful Links

Ready to build? Get started in minutes.