API Documentation
TokShop exposes an OpenAI-compatible API. Base URL: https://tokshop.xyz/v1
1. Get an API key
Register, top up your balance, then create a key in the dashboard. Keys look like sk-tok-...and are shown only once.
2. List models
curl https://tokshop.xyz/v1/models
Public endpoint. Returns model ids, context windows and USD pricing per 1M tokens.
3. Chat completions
curl https://tokshop.xyz/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-tok-YOUR_KEY" \
-d '{
"model": "deepseek-v3.2",
"messages": [{"role": "user", "content": "Hello!"}]
}'With the official OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(
base_url="https://tokshop.xyz/v1",
api_key="sk-tok-YOUR_KEY",
)
resp = client.chat.completions.create(
model="deepseek-v3.2",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)4. Streaming
Set stream: true. Server-sent events, identical to OpenAI's format.
resp = client.chat.completions.create(
model="deepseek-v3.2",
messages=[{"role": "user", "content": "Hello!"}],
stream=True,
)
for chunk in resp:
print(chunk.choices[0].delta.content or "", end="")5. Billing
- Prepaid USD credits; each request is deducted from the balance.
- Cost = input_tokens x input_price / 1M + output_tokens x output_price / 1M.
- When the balance reaches zero, requests return
402 insufficient_balance. - Every call is logged and auditable in your dashboard.
Errors
401- missing or invalid API key402- insufficient balance404- unknown model
Support
Questions, invoices or enterprise volume? Email us — we reply within one business day: mingxinai@agentmail.to / 13426086861@139.com