Developer docs
Call Chinese models through one SmarToken key and Base URL. This guide covers the OpenAI-compatible Chat Completions API. 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
Use or create your API key
- Step 3
Check your trial or available credit
- Step 4
Set the Base URL
- Step 5
Try Playground or call /v1/chat/completions
https:// thesmartoken.com /v1Base URLEligible accounts may receive trial credit after approval. Check its status before your first call. Valid trial credit is used first, followed by referral and promotional credit, then paid balance. See trial terms.
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
api_key = os.environ["SMTOKEN_API_KEY"]
client = OpenAI(
api_key=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"}},
)
message = response.choices[0].message
print(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" },
});
const message = response.choices[0].message;
console.log(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 model ID | DeepSeek |
| - | deepseek-flash-dedicated model ID | DeepSeek |
| - | deepseek-v4-pro-dedicated model ID | DeepSeek |
| - | kimi-k3.1-pro model ID | Moonshot AI |
| - | kimi-k2.7-code model ID | Moonshot AI |
| deepseek-flash | deepseek-chat model ID | DeepSeek |
| deepseek/deepseek-v4-pro | deepseek-v4-pro model ID | DeepSeek |
| moonshot/kimi-k2.6 | kimi-k2.6 model ID | 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." }
]
}'Function calling
The model returns a tool request; your application executes the function and sends its result back. This example uses sample weather data. Install the OpenAI Python SDK and set SMTOKEN_API_KEY before running it. Check the model directory for route support.
import json
import os
from openai import OpenAI
api_key = os.environ["SMTOKEN_API_KEY"]
client = OpenAI(
api_key=api_key,
base_url="https:/ / thesmartoken.com/ v1",
max_retries=0,
)
model = "deepseek-chat"
tools = [{"type": "function", "function": {
"name": "get_weather", "description": "Get sample weather for a city",
"parameters": {"type": "object", "properties": {
"city": {"type": "string"}}, "required": ["city"]}
}}]
messages = [{"role": "user", "content": "What's the weather in Paris? Use the tool."}]
first = client.chat.completions.create(
model=model,
messages=messages,
tools=tools,
tool_choice="auto",
max_tokens=512,
)
message = first.choices[0].message
if not message.tool_calls:
print(message.content) # The model may choose not to call a tool.
else:
# Preserve the assistant's tool calls and reasoning_content when present.
tool_calls = [
call.model_dump(exclude_none=True)
for call in message.tool_calls
]
assistant = {
"role": "assistant",
"content": message.content,
"tool_calls": tool_calls,
}
reasoning = getattr(message, "reasoning_content", None)
if reasoning is not None:
assistant["reasoning_content"] = reasoning
messages.append(assistant)
for call in message.tool_calls:
if call.function.name != "get_weather":
raise ValueError("Unexpected tool")
args = json.loads(call.function.arguments)
# Replace this sample with your own trusted function implementation.
result = {"city": args["city"], "weather": "sunny, 18 C (sample)"}
messages.append({"role": "tool", "tool_call_id": call.id,
"content": json.dumps(result)})
final = client.chat.completions.create(
model=model,
messages=messages,
tools=tools,
tool_choice="auto",
max_tokens=512,
)
reply = final.choices[0].message
print(reply.content)
print(final.usage)Model IDs
Check currently enabled IDs through 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 model ID | DeepSeek | chat, coding | See current pricing |
| deepseek-flash-dedicated model ID | DeepSeek | chat, coding | See current pricing |
| deepseek-v4-pro-dedicated model ID | DeepSeek | chat, coding | See current pricing |
| kimi-k3.1-pro model ID | Moonshot AI | chat, coding | See current pricing |
| kimi-k2.7-code model ID | Moonshot AI | chat, coding | See current pricing |
| deepseek-chat model ID | DeepSeek | coding copilots, support agents | See current pricing |
| deepseek-v4-pro model ID | DeepSeek | research, coding | See current pricing |
| kimi-k2.6 model ID | Moonshot AI | research assistants, codebase analysis | See current pricing |
| kimi-k3 model ID | Moonshot AI | deep research, agent planning | See current pricing |
| glm-5.2 model ID | Z.ai | enterprise assistants, coding support | See current pricing |
| glm-5.3 model ID | Z.ai | enterprise assistants, coding support | See current pricing |
| minimax-m2 model ID | MiniMax | coding agents, text analysis | See current pricing |
| minimax-m3 model ID | MiniMax | coding agents, tool-use workflows | See current pricing |
| hy4-flash model ID | Tencent Hunyuan | text generation | See current pricing |
| hy4 model ID | Tencent Hunyuan | text generation | See current pricing |
| deepseek-v4.1-flash-1017 model ID | DeepSeek | text generation | See current pricing |
| deepseek-v4-pro-0813 model ID | DeepSeek | text generation | See current pricing |
| deepseek-v4-pro-202606 model ID | DeepSeek | text generation | See current pricing |
| hy3 model ID | Tencent Hunyuan | text generation | See current pricing |
| glm-5.3-flash model ID | Z.ai | text generation | See current pricing |
| glm-5.3-flashx model ID | Z.ai | text generation | See current pricing |
| kimi-k3.1-pro-highspeed model ID | Moonshot AI | text generation | See current pricing |
| kimi-k2.8-preview model ID | Moonshot AI | text generation | See current pricing |
| kimi-k2.7-code-highspeed model ID | Moonshot AI | text generation | See current pricing |
| minimax-m3.1-flash model ID | MiniMax | text generation | See current pricing |
| mimo-v2.6-pro model ID | Xiaomi | text generation | See current pricing |
| mimo-v2.6-flash model ID | Xiaomi | text generation | See current pricing |
| step-5-preview model ID | StepFun | text generation | See current pricing |
| hy-mt2-pro model ID | Tencent Hunyuan | translation | See current pricing |
| hy-mt2-plus model ID | Tencent Hunyuan | translation | See current pricing |
| hy-mt2-lite model ID | Tencent Hunyuan | translation | See current pricing |
| kinfra-text-embedding-0.6b model ID | Kinfra | semantic search | See current pricing |
| kinfra-text-embedding-4b model ID | Kinfra | semantic search | See current pricing |
| kinfra-vl-embedding-2b model ID | Kinfra | multimodal search | See current pricing |
| kinfra-vl-embedding-8b model ID | Kinfra | multimodal search | See current pricing |
| seedream-image-v5.0-pro model ID | ByteDance | image generation | See current pricing |
| seedream-image-v5.0-flash model ID | ByteDance | image generation | See current pricing |
| seedream-image-v5.5 model ID | ByteDance | image generation | See current pricing |
| hy-image-v3.5-preview model ID | Tencent Hunyuan | image generation | See current pricing |
| wand-vega-image-lite model ID | WAND | image generation | See current pricing |
| wand-vega-image-flash model ID | WAND | image generation | See current pricing |
| wand-vega-image-pro model ID | WAND | image generation | See current pricing |
| vidu-image-q2 model ID | Vidu | image generation | See current pricing |
| kling-image-v3 model ID | Kling | image generation | See current pricing |
| kling-image-o1 model ID | Kling | image generation | See current pricing |
| kling-image-v3-omni model ID | Kling | image generation | See current pricing |
| hidream-image-o1-1.5 model ID | HiDream | image generation | See current pricing |
| hidream-image-o1-1.5-edit model ID | HiDream | image editing | See current pricing |
| mureka-music-v9 model ID | Mureka | music generation | See current pricing |
| minimax-music-v3.0 model ID | MiniMax | music generation | See current pricing |
| hy-asr-3.0-preview model ID | Tencent Hunyuan | speech recognition | See current pricing |
| wand-asr-v1 model ID | Tencent | speech recognition | See current pricing |
| minimax-speech-02-turbo model ID | MiniMax | speech synthesis | See current pricing |
| minimax-speech-02-hd model ID | MiniMax | speech synthesis | See current pricing |
| minimax-speech-2.6-turbo model ID | MiniMax | speech synthesis | See current pricing |
| minimax-speech-2.6-hd model ID | MiniMax | speech synthesis | See current pricing |
| minimax-speech-2.8-turbo model ID | MiniMax | speech synthesis | See current pricing |
| minimax-speech-2.8-hd model ID | MiniMax | speech synthesis | See current pricing |
| hy-video-v1.5 model ID | Tencent Hunyuan | video generation | See current pricing |
| kling-video-v4 model ID | Kling | video generation | See current pricing |
| kling-video-v3 model ID | Kling | video generation | See current pricing |
| kling-video-v3-turbo model ID | Kling | video generation | See current pricing |
| kling-video-v3-omni model ID | Kling | video generation | See current pricing |
| minimax-video-h3 model ID | MiniMax | video generation | See current pricing |
| minimax-video-h3-max model ID | MiniMax | video generation | See current pricing |
| vidu-video-q4-preview model ID | Vidu | video generation | See current pricing |
| vidu-video-q3 model ID | Vidu | video generation | See current pricing |
| vidu-video-q3-pro model ID | Vidu | video generation | See current pricing |
| vidu-video-q3-turbo model ID | Vidu | video generation | See current pricing |
| pixverse-video-c1 model ID | PixVerse | video generation | See current pricing |
| pixverse-video-v6.0 model ID | PixVerse | video generation | See current pricing |
| kling-video-v4-flash model ID | Kling | video generation | See current pricing |
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. Supported function-tool requests also accept tool result messages. |
| stream | Boolean. false returns JSON; true returns SSE deltas, including function calls on supported routes. |
| 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. |
| max_completion_tokens | Alias for max_tokens; use only one of these fields. The same limits and reservation apply. |
| thinking | {type: enabled|disabled}. Omitted preserves the upstream default. For Kimi K3, K3.1 Pro, K2.7 Code and GLM 5.3, omit this option. Explicit modes map to reasoning_effort high/none. |
| temperature | 0–2 with thinking.type=disabled. |
| top_p | Flash: thinking enabled (or omitted), 0.95–1. Pro: explicit thinking disabled, greater than 0 and at most 1. |
| stop | A non-empty string or 1–16 non-empty strings. |
| response_format | DeepSeek Direct Flash and Pro support {type: json_object}. Strict JSON Schema is supported on those routes and on the dedicated DeepSeek Pro route, GLM 5.2 and Kimi K2.7 Code: {type: json_schema, json_schema: {name, strict: true, schema}}. Ask for JSON in the prompt. A length-limited response may be incomplete. JSON Schema cannot be combined with tools or stop. |
| tools / tool_choice | DeepSeek Direct Flash and Pro and dedicated DeepSeek, Kimi K3, K3.1 Pro, K2.7 Code, GLM and MiniMax routes support up to 32 client-side function tools. Kimi K3 and K3.1 Pro tool requests use 5-minute cache writes, billed as input. Pass assistant tool calls, their tool results, and all reasoning_content back unchanged for subsequent thinking-mode requests. Kimi K2.7 Code supports only auto or none for tool_choice. Strict function tools and server-side tools are not supported. |
| stream_options | Only with stream=true. include_usage accepts a boolean; true emits a final usage chunk with choices:[]. |
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.
Mode rules reviewed November 6, 2026 against DeepSeek’s API reference.
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 the applicable route and request-time offer shown on the pricing page.
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, invalid 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.