Quickstart
From sign-up to your first successful call: register, top up, create a token, send a chat request and submit an async image task.
The five steps below take a few minutes and end with your first successful call. The examples use curl; Python and Node samples are on each endpoint's API reference (Chinese).
1. Register and sign in
Open tqai.org, register an account and sign in to the console.
2. Top up
Top up on the console's Wallet page; details are under Wallet and top-ups (Chinese). Every call is deducted from the wallet balance, and when the balance is short the call returns 403 (error code insufficient_user_quota).
Prices are on the pricing page after you sign in.
3. Create a token
On the console's API Keys page, click Create API Key, give it a name and leave the other options at their defaults. Copy the key from the list after saving. This key is the token (API Key) used to call the API and looks like sk-.... Details are under Token management (Chinese).
A token is a payment credential for your wallet. Never put it in front-end code, a public repository or a screenshot. If it leaks, disable or delete it in the console immediately.
The commands below put the token in an environment variable:
export TQAI_KEY=sk-your-token4. First call: chat
curl https://tqai.org/v1/chat/completions \
-H "Authorization: Bearer $TQAI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-4-argon",
"messages": [{"role": "user", "content": "Introduce yourself in one sentence"}]
}'The response uses the OpenAI format and the answer is in choices[0].message.content. The call shows up in the console's usage log with the amount deducted. Endpoint paths and authentication for the three formats are in Base URL and authentication (Chinese); parameters are in Chat: OpenAI format (Chinese).
5. One async image task
Image generation takes anywhere from tens of seconds to a few minutes, so use an async task: submit it, get a task ID immediately, then poll for the result.
Submit: add two headers to the image request. Prefer: respond-async turns on async mode, and Idempotency-Key takes a new value for every new task.
curl https://tqai.org/v1/images/generations \
-H "Authorization: Bearer $TQAI_KEY" \
-H "Content-Type: application/json" \
-H "Prefer: respond-async" \
-H "Idempotency-Key: quickstart-001" \
-d '{"model": "nano-2-2k", "prompt": "An orange cat dozing on a windowsill, watercolour style"}'The call returns 202:
{ "task_id": "task_...", "status": "queued" }Poll: query the task with the returned task_id. With wait=45 the request returns when the task reaches its final state or after 45 seconds, whichever comes first:
curl "https://tqai.org/v1/images/tasks/task_...?wait=45" \
-H "Authorization: Bearer $TQAI_KEY" \
--max-time 60statusiscompleted: the top-levelurlis the full address of the first image, anddata[].urlis each image's path on this site (prefix it withhttps://tqai.org). Results are kept for 7 days, so download them in time.statusisqueuedorin_progress: poll again.statusisfailed:error.messagegives the failure category and the charge for that task has already been refunded in full.
The complete flow and the caveats are in Async tasks and Images: async tasks (Chinese).
Next steps
- Video tasks: confirm the charge with the quote endpoint before submitting (Chinese).
- Using a TQAI token in Claude Code or Cherry Studio: see Claude Code and Cherry Studio (Chinese).
- When something fails: see Errors and retries and the FAQ (Chinese).
Only this page, the home page and Errors and retries have an English version so far; other pages are Chinese only.
Developer entry: AI model API aggregation and enterprise API service
TQAI (tqai.org) aggregates AI model APIs for developers and enterprise integration: one base URL and one token for chat, image and video APIs, in the OpenAI, Anthropic and Gemini formats. Enterprise accounts can get invoices, pay by bank transfer and sign a contract.
Errors and retries
What an error response looks like, what the common HTTP status codes and error codes mean, which errors to retry and how.