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

  1. Step 1

    Continue with Google

  2. Step 2

    Use or create your API key

  3. Step 3

    Check your trial or available credit

  4. Step 4

    Set the Base URL

  5. Step 5

    Try Playground or call /v1/chat/completions

Base URLhttps://thesmartoken.com/v1Base URL

Eligible 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.

curlcurl
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.

PythonPython
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)
JavaScriptJavaScript
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.

curlcurl
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 IDSmarToken model IDProvider
-deepseek-v4.1-flash model IDDeepSeek
-deepseek-flash-dedicated model IDDeepSeek
-deepseek-v4-pro-dedicated model IDDeepSeek
-kimi-k3.1-pro model IDMoonshot AI
-kimi-k2.7-code model IDMoonshot AI
deepseek-flashdeepseek-chat model IDDeepSeek
deepseek/deepseek-v4-prodeepseek-v4-pro model IDDeepSeek
moonshot/kimi-k2.6kimi-k2.6 model IDMoonshot AI
Read the OpenRouter alternative guide

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].

curlcurl
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.

PythonPython
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 IDVendorBest forPrice / 1M tokens
deepseek-v4.1-flash model IDDeepSeekchat, codingSee current pricing
deepseek-flash-dedicated model IDDeepSeekchat, codingSee current pricing
deepseek-v4-pro-dedicated model IDDeepSeekchat, codingSee current pricing
kimi-k3.1-pro model IDMoonshot AIchat, codingSee current pricing
kimi-k2.7-code model IDMoonshot AIchat, codingSee current pricing
deepseek-chat model IDDeepSeekcoding copilots, support agentsSee current pricing
deepseek-v4-pro model IDDeepSeekresearch, codingSee current pricing
kimi-k2.6 model IDMoonshot AIresearch assistants, codebase analysisSee current pricing
kimi-k3 model IDMoonshot AIdeep research, agent planningSee current pricing
glm-5.2 model IDZ.aienterprise assistants, coding supportSee current pricing
glm-5.3 model IDZ.aienterprise assistants, coding supportSee current pricing
minimax-m2 model IDMiniMaxcoding agents, text analysisSee current pricing
minimax-m3 model IDMiniMaxcoding agents, tool-use workflowsSee current pricing
hy4-flash model IDTencent Hunyuantext generationSee current pricing
hy4 model IDTencent Hunyuantext generationSee current pricing
deepseek-v4.1-flash-1017 model IDDeepSeektext generationSee current pricing
deepseek-v4-pro-0813 model IDDeepSeektext generationSee current pricing
deepseek-v4-pro-202606 model IDDeepSeektext generationSee current pricing
hy3 model IDTencent Hunyuantext generationSee current pricing
glm-5.3-flash model IDZ.aitext generationSee current pricing
glm-5.3-flashx model IDZ.aitext generationSee current pricing
kimi-k3.1-pro-highspeed model IDMoonshot AItext generationSee current pricing
kimi-k2.8-preview model IDMoonshot AItext generationSee current pricing
kimi-k2.7-code-highspeed model IDMoonshot AItext generationSee current pricing
minimax-m3.1-flash model IDMiniMaxtext generationSee current pricing
mimo-v2.6-pro model IDXiaomitext generationSee current pricing
mimo-v2.6-flash model IDXiaomitext generationSee current pricing
step-5-preview model IDStepFuntext generationSee current pricing
hy-mt2-pro model IDTencent HunyuantranslationSee current pricing
hy-mt2-plus model IDTencent HunyuantranslationSee current pricing
hy-mt2-lite model IDTencent HunyuantranslationSee current pricing
kinfra-text-embedding-0.6b model IDKinfrasemantic searchSee current pricing
kinfra-text-embedding-4b model IDKinfrasemantic searchSee current pricing
kinfra-vl-embedding-2b model IDKinframultimodal searchSee current pricing
kinfra-vl-embedding-8b model IDKinframultimodal searchSee current pricing
seedream-image-v5.0-pro model IDByteDanceimage generationSee current pricing
seedream-image-v5.0-flash model IDByteDanceimage generationSee current pricing
seedream-image-v5.5 model IDByteDanceimage generationSee current pricing
hy-image-v3.5-preview model IDTencent Hunyuanimage generationSee current pricing
wand-vega-image-lite model IDWANDimage generationSee current pricing
wand-vega-image-flash model IDWANDimage generationSee current pricing
wand-vega-image-pro model IDWANDimage generationSee current pricing
vidu-image-q2 model IDViduimage generationSee current pricing
kling-image-v3 model IDKlingimage generationSee current pricing
kling-image-o1 model IDKlingimage generationSee current pricing
kling-image-v3-omni model IDKlingimage generationSee current pricing
hidream-image-o1-1.5 model IDHiDreamimage generationSee current pricing
hidream-image-o1-1.5-edit model IDHiDreamimage editingSee current pricing
mureka-music-v9 model IDMurekamusic generationSee current pricing
minimax-music-v3.0 model IDMiniMaxmusic generationSee current pricing
hy-asr-3.0-preview model IDTencent Hunyuanspeech recognitionSee current pricing
wand-asr-v1 model IDTencentspeech recognitionSee current pricing
minimax-speech-02-turbo model IDMiniMaxspeech synthesisSee current pricing
minimax-speech-02-hd model IDMiniMaxspeech synthesisSee current pricing
minimax-speech-2.6-turbo model IDMiniMaxspeech synthesisSee current pricing
minimax-speech-2.6-hd model IDMiniMaxspeech synthesisSee current pricing
minimax-speech-2.8-turbo model IDMiniMaxspeech synthesisSee current pricing
minimax-speech-2.8-hd model IDMiniMaxspeech synthesisSee current pricing
hy-video-v1.5 model IDTencent Hunyuanvideo generationSee current pricing
kling-video-v4 model IDKlingvideo generationSee current pricing
kling-video-v3 model IDKlingvideo generationSee current pricing
kling-video-v3-turbo model IDKlingvideo generationSee current pricing
kling-video-v3-omni model IDKlingvideo generationSee current pricing
minimax-video-h3 model IDMiniMaxvideo generationSee current pricing
minimax-video-h3-max model IDMiniMaxvideo generationSee current pricing
vidu-video-q4-preview model IDViduvideo generationSee current pricing
vidu-video-q3 model IDViduvideo generationSee current pricing
vidu-video-q3-pro model IDViduvideo generationSee current pricing
vidu-video-q3-turbo model IDViduvideo generationSee current pricing
pixverse-video-c1 model IDPixVersevideo generationSee current pricing
pixverse-video-v6.0 model IDPixVersevideo generationSee current pricing
kling-video-v4-flash model IDKlingvideo generationSee 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.

ParameterSupported contract
model / messagesUse 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.
streamBoolean. false returns JSON; true returns SSE deltas, including function calls on supported routes.
max_tokensInteger 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_tokensAlias 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.
temperature0–2 with thinking.type=disabled.
top_pFlash: thinking enabled (or omitted), 0.95–1. Pro: explicit thinking disabled, greater than 0 and at most 1.
stopA non-empty string or 1–16 non-empty strings.
response_formatDeepSeek 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_choiceDeepSeek 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_optionsOnly 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.

Security reminder: before topping up, confirm the address bar shows 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_quota and include error.topup_url pointing 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.