Documentation

DocsQuickstart

Quickstart

TokonLab provides a unified API gateway to access 200+ Chinese AI models. Our API is fully compatible with the OpenAI SDK — just change the base URL and you're ready to go.

1. Get your API key

Sign up for a free account and generate your API key from the dashboard. Free tier includes 50 requests/day with no credit card required.

sk-tokon-xxxxxxxxxxxxxxxxxxxxxxxxxxxx

2. Install the SDK

bash
# Python
pip install openai

# Node.js
npm install openai

3. Make your first request

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokonlab.com/v1",
    api_key="sk-tokon-your-api-key",
)

response = client.chat.completions.create(
    model="deepseek/deepseek-r1",
    messages=[
        {
            "role": "user",
            "content": "What is the capital of France?"
        }
    ]
)

print(response.choices[0].message.content)
# Output: The capital of France is Paris.
javascript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.tokonlab.com/v1',
  apiKey: 'sk-tokon-your-api-key',
});

const response = await client.chat.completions.create({
  model: 'deepseek/deepseek-r1',
  messages: [
    {
      role: 'user',
      content: 'What is the capital of France?'
    }
  ],
});

console.log(response.choices[0].message.content);
bash
curl https://api.tokonlab.com/v1/chat/completions \
  -H "Authorization: Bearer sk-tokon-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-r1",
    "messages": [
      {
        "role": "user",
        "content": "What is the capital of France?"
      }
    ]
  }'

Base URL

https://api.tokonlab.com/v1

Supported endpoints

POST/v1/chat/completionsChat completions (streaming supported)
POST/v1/completionsText completions
POST/v1/embeddingsText embeddings
GET/v1/modelsList available models

Next steps