Skip to content
TutujinAPI

Get started

Quickstart

Send your first request in 4 steps — sign up and create an API key, point base_url at https://www.tutujin.com/v1, call a model with cURL, Python or Node.js, then check the charge in the console.

Tutujin API is compatible with the OpenAI API. Code that already uses an OpenAI SDK needs two changes: set base_url to https://www.tutujin.com/v1 and replace api_key with a key from your console. The whole thing takes about five minutes.

Step 1: Sign up and add credit

  1. Create an account on the sign-up page and open the console.
  2. Add credit in the console. Balances are in CNY and you pay for what you use — no monthly fee, no minimum spend.
  3. For company purchasing or invoices, contact support on WeChat at JsnonoChat.

Step 2: Create an API key

Create a key on the API Keys page of the console. Each key has its own settings:

SettingWhat it does
NameTells projects and environments apart, e.g. "support-bot-prod"
GroupWhich line the key uses and which price tier it is billed at — see Choosing a group
Spending limitThe most this key can spend; it stops working once the limit is reached
ExpiryThe key stops working after this date — handy for temporary or contractor projects
Model allowlistOnly the listed models can be called
IP allowlistOnly the listed server IPs can call

Keys start with sk-. Use one key per project and per environment, so you can disable one without touching anything else.

Never put a key in web, app or mini-program front-end code — anyone with developer tools can read it. Keep keys on your own servers and load them from environment variables. More in API key security best practices.

Step 3: Set the key and base URL

Put the key in an environment variable; every example below reads it from there:

cURL
export TUTUJIN_API_KEY="sk-your-key"

The base URL depends on the API format you use:

SDK or API you useBase URL
OpenAI-compatible APIs (Chat Completions, Responses, Embeddings, images, audio…)https://www.tutujin.com/v1
Anthropic SDK (native Claude Messages)https://www.tutujin.com
Google Gen AI SDK (native Gemini generateContent)https://www.tutujin.com

The Anthropic and Google SDKs append /v1/messages and /v1beta/models/... themselves, so give them the site root only.

Step 4: Send your first request

Set model to a model name from the model hub. The examples use gpt-5.4-mini:

curl https://www.tutujin.com/v1/chat/completions \
  -H "Authorization: Bearer $TUTUJIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [
      {"role": "user", "content": "Introduce yourself in one sentence"}
    ]
  }'

The response has the same shape as OpenAI's. The answer is in choices[0].message.content and this call's usage is in usage:

JSON
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "gpt-5.4-mini",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 14, "completion_tokens": 32, "total_tokens": 46 }
}

A 401 means the key is wrong or no longer valid; a 403 usually means the balance ran out or the key's allowlists block the call. See Errors and retries for the full list.

Step 5: Check usage and charges

Every call leaves a record in Logs in the console with the model, group, input and output tokens and the cost. For token-billed models, cost = input tokens × input price + output tokens × output price. The example model's cheapest group currently costs:

ModelVendorCheapest groupInput ¥/1MOutput ¥/1MPer request ¥
gpt-5.4-miniOpenAIStandard¥1.5¥9—

Prices in CNY, cheapest group for each model; updated Nov 13, 2026, 1:33 AM.

Billing details are in Billing and usage.

Next steps

Still stuck? Add our WeChat support JsnonoChat and send the request id from the error message, and we will look into it.