OpenAI-compatible API
Developer docs
Use one SmarToken key to call DeepSeek, Kimi, Qwen and other China-first model routes with the same Chat Completions shape your team already knows.
Quickstart
- Step 1
Continue with Google
- Step 2
Receive trial credit if risk checks pass
- Step 3
Create a console sk key
- Step 4
Call /v1/chat/completions
curl -s "https://thesmartoken.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SMTOKEN_API_KEY" \
-d '{
"model": "deepseek-chat",
"stream": false,
"messages": [
{ "role": "user", "content": "Explain tool calling in one paragraph." }
]
}'OpenAI SDK migration
Keep your existing OpenAI SDK. Change baseURL to https://thesmartoken.com/v1, then set model to a SmarToken model ID.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_SMARTOKEN_KEY",
base_url="https://thesmartoken.com/v1",
)
completion = client.chat.completions.create(
model="kimi-k2",
messages=[{"role": "user", "content": "Draft a product launch checklist."}],
)
print(completion.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SMTOKEN_API_KEY,
baseURL: "https://thesmartoken.com/v1",
});
const completion = await client.chat.completions.create({
model: "qwen-plus",
messages: [{ role: "user", content: "Summarize this API design." }],
});
console.log(completion.choices[0]?.message?.content);OpenRouter migration
For Chinese model traffic, replace the OpenRouter base URL with https://thesmartoken.com/v1 and use a SmarToken key. Common OpenRouter-style IDs such as deepseek/deepseek-chat, qwen/qwen-plus and moonshot/kimi-k2 are normalized to SmarToken routes.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SMTOKEN_API_KEY,
baseURL: "https://thesmartoken.com/v1",
});
const completion = await client.chat.completions.create({
model: "deepseek/deepseek-chat",
messages: [{ role: "user", content: "Review this TypeScript function." }],
});| OpenRouter-style ID | SmarToken model ID | Provider |
|---|---|---|
| deepseek/deepseek-chat | deepseek-chat | DeepSeek |
| moonshot/kimi-k2 | kimi-k2 | Moonshot AI |
| qwen/qwen-plus | qwen-plus | Alibaba Cloud |
| z-ai/glm-4-flash | glm-4-flash | Z.ai |
| bytedance/doubao-seed | doubao-seed | ByteDance |
| baidu/ernie-4-turbo | ernie-4-turbo | Baidu |
| tencent/hunyuan-turbos | hunyuan-turbos | Tencent Cloud |
| minimax/minimax-m2 | minimax-m2 | MiniMax |
Streaming
Set stream:true to receive OpenAI-compatible SSE chunks. Usage is written and balance is deducted after the stream finishes.
curl -N "https://thesmartoken.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SMTOKEN_API_KEY" \
-d '{
"model": "deepseek-chat",
"stream": true,
"messages": [
{ "role": "user", "content": "Write a short onboarding email." }
]
}'Model IDs
You can also fetch the live list from GET https://thesmartoken.com/v1/models. The API includes catalog pricing, final billable pricing and the public platform fee.
| Model ID | Vendor | Best for | Price / 1M tokens |
|---|---|---|---|
| deepseek-chat | DeepSeek | coding copilots, support agents | $0.6 input / $1.8 output |
| kimi-k2 | Moonshot AI | research assistants, codebase analysis | $0.72 input / $3 output |
| qwen-plus | Alibaba Cloud | multilingual chat, structured extraction | $1.44 input / $5.76 output |
| glm-4-flash | Z.ai | internal tools, knowledge assistants | $0.96 input / $3.84 output |
| doubao-seed | ByteDance | consumer chat, content workflows | $0.84 input / $3.36 output |
| ernie-4-turbo | Baidu | Chinese knowledge QA, enterprise search | $1.08 input / $4.32 output |
| hunyuan-turbos | Tencent Cloud | enterprise assistants, code generation | $0.96 input / $3.84 output |
| minimax-m2 | MiniMax | coding agents, tool-use workflows | $0.36 input / $1.44 output |
| step-3 | StepFun | coding tools, agent platforms | $0.6 input / $2.4 output |
| baichuan4-turbo | Baichuan AI | domain assistants, Chinese knowledge QA | $1.8 input / $1.8 output |
| spark-x1 | iFLYTEK | education assistants, reasoning QA | $0.84 input / $3.36 output |
| sensenova-v6 | SenseTime | multimodal assistants, visual QA | $0.96 input / $3.84 output |
| pangu-nlp | Huawei Cloud | industry assistants, private cloud workflows | $1.2 input / $4.8 output |
| 360zhinao2-o1 | Qihoo 360 | security assistants, Chinese chat | $0.48 input / $1.2 output |
| yi-large | 01.AI | bilingual writing, structured output | $1.08 input / $1.08 output |
| internlm3 | Shanghai AI Laboratory | self-hosted chat, research evals | $0.24 input / $0.96 output |
| longcat-flash | Meituan | agentic reasoning, multimodal prototypes | $0.48 input / $1.92 output |
Billing and usage
SmarToken uses prepaid USD wallet balance. Each completed request records prompt tokens, completion tokens, final billable cost and provider latency; streaming requests settle after the stream finishes. Billable token rates are catalog model rates plus a transparent 20% platform fee.
Usage overview
Review recent model calls, token totals, cost and latency from the console.
Wallet ledger
Track top-ups, manual adjustments, trial credit and usage debits.
Payment safety
Use only the official domain before top-up or API-key operations.
https://thesmartoken.com. Avoid unfamiliar links, search ads or cloned domains when entering credentials or payment details.Budget limits
API keys can be scoped by daily budget, monthly budget and allowed model family. Requests are blocked before provider calls when a key is revoked, outside its model scope, or over budget.
Daily budget
Protect demos, CI jobs and early customer pilots.
Monthly budget
Keep spend predictable across production keys.
Model scope
Limit a key to DeepSeek, Kimi, Qwen or China models.
Error codes
- 400 - Unknown model, empty messages or blocked prompt.
- 401 - Missing, invalid or revoked API key.
- 402 - Insufficient balance or API key budget exceeded.
- 503 - No OpenAI-compatible upstream route is configured.