OpenAI-compatible API
Developer docs
Call Chinese model families through one SmarToken key and Base URL. This native endpoint documents the text Chat Completions contract below. Use GET /v1/models for current IDs.
Submitted conversations and model replies are stored encrypted for support and operational review until manually removed. See the privacy policy for details.
Quickstart
- Step 1
Continue with Google
- Step 2
Top up your account
- Step 3
Create a console sk key
- Step 4
Call /v1/chat/completions
curl --fail-with-body -sS "https://thesmartoken.com/v1/chat/completions" \
-H "Authorization: Bearer $SMTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role":"user","content":"Reply with exactly OK."}],
"max_tokens": 8,
"thinking": {"type":"disabled"}
}'OpenAI SDK migration
Keep your existing OpenAI SDK. Change baseURL to https://thesmartoken.com/v1, then set model to a SmarToken model ID.
Python: pip install openai. Node.js (JavaScript): npm install openai, save the example as first-call.mjs, then run node first-call.mjs. Set SMTOKEN_API_KEY in your environment before running.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["SMTOKEN_API_KEY"],
base_url="https://thesmartoken.com/v1", max_retries=0)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Reply with exactly OK."}],
max_tokens=8,
extra_body={"thinking": {"type": "disabled"}},
)
print(response.choices[0].message.content)
print(response.usage)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SMTOKEN_API_KEY,
baseURL: "https://thesmartoken.com/v1", maxRetries: 0,
});
const response = await client.chat.completions.create({
model: "deepseek-chat",
messages: [{ role: "user", content: "Reply with exactly OK." }],
max_tokens: 8,
thinking: { type: "disabled" },
});
console.log(response.choices[0].message.content);
console.log(response.usage);OpenRouter migration
For supported text workloads, use https://thesmartoken.com/v1 with a SmarToken key. The aliases below map common OpenRouter-style IDs to SmarToken model IDs. Prefer the catalog ID in production code.
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-v4.1-flash | DeepSeek |
| - | deepseek-tokenhub-flash | DeepSeek |
| - | deepseek-tokenhub-pro | DeepSeek |
| - | kimi-k3.1-pro | Moonshot AI |
| - | kimi-k2.7-code | Moonshot AI |
| deepseek-flash | deepseek-chat | DeepSeek |
| deepseek/deepseek-v4-pro | deepseek-v4-pro | DeepSeek |
| moonshot/kimi-k3 | kimi-k3 | Moonshot AI |
Streaming
Set stream:true to receive OpenAI-compatible SSE chunks. Usage is written and balance is deducted after the stream finishes. Set stream_options.include_usage=true for a final usage chunk with empty choices before [DONE].
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 and billable pricing without an additional platform surcharge.
| Model ID | Vendor | Best for | Price / 1M tokens |
|---|---|---|---|
| deepseek-v4.1-flash | DeepSeek | chat, coding | $0.3 input / $1.2 output |
| deepseek-tokenhub-flash | DeepSeek | chat, coding | $0.3 input / $1.2 output |
| deepseek-tokenhub-pro | DeepSeek | chat, coding | $1.74 input / $3.48 output |
| kimi-k3.1-pro | Moonshot AI | chat, coding | $2 input / $10 output |
| kimi-k2.7-code | Moonshot AI | chat, coding | $0.95 input / $4 output |
| deepseek-chat | DeepSeek | coding copilots, support agents | $0.3 input / $1.2 output |
| deepseek-v4-pro | DeepSeek | research, coding | $1.32 input / $3.96 output |
| kimi-k3 | Moonshot AI | deep research, agent planning | $3 input / $15 output |
| glm-5.2 | Z.ai | enterprise assistants, coding support | $1.4 input / $4.4 output |
| glm-5.3 | Z.ai | enterprise assistants, coding support | $1.4 input / $4.4 output |
| minimax-m2 | MiniMax | coding agents, text analysis | $0.3 input / $1.2 output |
| kimi-k2 | Moonshot AI | research assistants, codebase analysis | $0.6 input / $2.5 output |
| kimi-k2.6 | Moonshot AI | research assistants, codebase analysis | $0.95 input / $4 output |
| qwen-plus | Alibaba Cloud | multilingual chat, structured extraction | $1.2 input / $4.8 output |
| qwen3.7-plus | Alibaba Cloud | multilingual chat, vision QA | $0.276 input / $1.101 output |
| glm-4-flash | Z.ai | internal tools, knowledge assistants | $0.8 input / $3.2 output |
| glm-5v-turbo | Z.ai | visual QA, document screenshots | $1.2 input / $4 output |
| doubao-seed | ByteDance | consumer chat, content workflows | $0.7 input / $2.8 output |
| ernie-4-turbo | Baidu | Chinese knowledge QA, enterprise search | $0.9 input / $3.6 output |
| hunyuan-turbos | Tencent Cloud | enterprise assistants, code generation | $0.8 input / $3.2 output |
| minimax-m3 | MiniMax | coding agents, tool-use workflows | $0.6 input / $2.4 output |
| step-3 | StepFun | coding tools, agent platforms | $0.5 input / $2 output |
| baichuan4-turbo | Baichuan AI | domain assistants, Chinese knowledge QA | $1.5 input / $1.5 output |
| spark-x1 | iFLYTEK | education assistants, reasoning QA | $0.7 input / $2.8 output |
| sensenova-v6 | SenseTime | multimodal assistants, visual QA | $0.8 input / $3.2 output |
| pangu-nlp | Huawei Cloud | industry assistants, private cloud workflows | $1 input / $4 output |
| 360zhinao2-o1 | Qihoo 360 | security assistants, Chinese chat | $0.4 input / $1 output |
| yi-large | 01.AI | bilingual writing, structured output | $0.9 input / $0.9 output |
| internlm3 | Shanghai AI Laboratory | self-hosted chat, research evals | $0.2 input / $0.8 output |
| longcat-flash | Meituan | agentic reasoning, multimodal prototypes | $0.4 input / $1.6 output |
| wan-t2v | Alibaba Cloud | promo clips, product demos | $2.5 input / $2.5 output |
| minimax-video-01 | MiniMax | marketing video drafts, avatar-style clips | $3 input / $3 output |
| happyhorse-t2v | Alibaba Cloud | creative video drafts, campaign concepts | $2.8 input / $2.8 output |
Native text API contract
A SmarToken key and wallet are separate from a DeepSeek official account. SmarToken keys work at this base URL; do not put an official DeepSeek key here or use a SmarToken key at api.deepseek.com.
| Parameter | Supported contract |
|---|---|
| model / messages | Use an enabled model ID from GET /v1/models. Text string content; system, user and assistant roles only. |
| stream | Boolean. false returns JSON; true returns SSE final-answer text. Reasoning content is not returned by this gateway. |
| max_tokens | Integer 1–393216, subject to context and available funds. Includes thinking tokens. If omitted, capped at 32768 or the affordable limit. The first-call example uses 8. |
| thinking | {type: enabled|disabled}. Omitted preserves the upstream default. Kimi K3, K3.1 Pro, K2.7 Code and GLM 5.3 cannot disable thinking; omit this option for these models. Explicit modes map to reasoning_effort high/none; reasoning_effort itself is not accepted. |
| temperature | 0–2, only with thinking.type=disabled. Other modes are rejected because the upstream ignores it. |
| top_p | Flash: thinking enabled (or omitted), 0.95–1. Pro: explicit thinking disabled, greater than 0 and at most 1. Other combinations are rejected. |
| stop | A non-empty string or 1–16 non-empty strings. |
| stream_options | Only with stream=true. include_usage accepts a boolean; true emits a final usage chunk with choices:[]. |
| Not supported | tools, tool_choice, tool messages, response_format, multimodal inputs, penalties, seed, logprobs and other unlisted fields return 400 with error.param. No silent ignoring. |
SSE HTTP 200 means the stream opened. A successful stream ends with a finish reason and [DONE]; an event:error or missing terminal marker is not success. Errors after streaming starts use event:error and do not emit [DONE]. Stop reading on error. Cancelled or unknown results must not be automatically retried. A legitimate length-limited response can contain no final text but still have billable tokens. The gateway does not automatically retry upstream inference.
Mode rules reviewed November 6, 2026 against DeepSeek’s API reference. Gateway support is narrower than the upstream API.
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 follow catalog rates without an additional platform surcharge.
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. Funds are reserved before generation and settled against confirmed usage. Interrupted requests with unknown usage keep a visible hold until reconciliation; contact support if a hold remains.
Daily budget
Protect demos, CI jobs and early customer pilots.
Monthly budget
Keep spend predictable across production keys.
Model scope
Scope keys to current DeepSeek models; a model-family scope does not enable a coming-soon route.
Error codes
- 400 - Invalid JSON, unknown model, invalid text messages, unsupported parameters or blocked prompt. Parameter errors include error.param.
- 401 - Missing, invalid or revoked API key.
- 402 - Insufficient balance or API key budget exceeded. Balance errors use type
insufficient_quotaand includeerror.topup_urlpointing to Billing. Stop automatic retries on 402; open the top-up URL, add credit, then send the next request. - 429 - Rate limit reached. Respect Retry-After.
- 502 - Upstream response did not finish correctly. Keep the request record; do not automatically replay an unknown result.
- 503 - No OpenAI-compatible upstream route is configured.