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

  1. Step 1

    Continue with Google

  2. Step 2

    Receive trial credit if risk checks pass

  3. Step 3

    Create a console sk key

  4. 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 IDSmarToken model IDProvider
deepseek/deepseek-chatdeepseek-chatDeepSeek
moonshot/kimi-k2kimi-k2Moonshot AI
qwen/qwen-plusqwen-plusAlibaba Cloud
z-ai/glm-4-flashglm-4-flashZ.ai
bytedance/doubao-seeddoubao-seedByteDance
baidu/ernie-4-turboernie-4-turboBaidu
tencent/hunyuan-turboshunyuan-turbosTencent Cloud
minimax/minimax-m2minimax-m2MiniMax
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.

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 IDVendorBest forPrice / 1M tokens
deepseek-chatDeepSeekcoding copilots, support agents$0.6 input / $1.8 output
kimi-k2Moonshot AIresearch assistants, codebase analysis$0.72 input / $3 output
qwen-plusAlibaba Cloudmultilingual chat, structured extraction$1.44 input / $5.76 output
glm-4-flashZ.aiinternal tools, knowledge assistants$0.96 input / $3.84 output
doubao-seedByteDanceconsumer chat, content workflows$0.84 input / $3.36 output
ernie-4-turboBaiduChinese knowledge QA, enterprise search$1.08 input / $4.32 output
hunyuan-turbosTencent Cloudenterprise assistants, code generation$0.96 input / $3.84 output
minimax-m2MiniMaxcoding agents, tool-use workflows$0.36 input / $1.44 output
step-3StepFuncoding tools, agent platforms$0.6 input / $2.4 output
baichuan4-turboBaichuan AIdomain assistants, Chinese knowledge QA$1.8 input / $1.8 output
spark-x1iFLYTEKeducation assistants, reasoning QA$0.84 input / $3.36 output
sensenova-v6SenseTimemultimodal assistants, visual QA$0.96 input / $3.84 output
pangu-nlpHuawei Cloudindustry assistants, private cloud workflows$1.2 input / $4.8 output
360zhinao2-o1Qihoo 360security assistants, Chinese chat$0.48 input / $1.2 output
yi-large01.AIbilingual writing, structured output$1.08 input / $1.08 output
internlm3Shanghai AI Laboratoryself-hosted chat, research evals$0.24 input / $0.96 output
longcat-flashMeituanagentic 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.

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.

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.
Get API Key