API Documentation
TokenShop exposes an OpenAI-compatible API. Any OpenAI SDK works — just change the base URL and API key. Usage is metered per token and charged against your prepaid balance.
1. Register (get key + trial credit)
curl -X POST https://tokshop.xyz/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com"}'2. List models & pricing
curl https://tokshop.xyz/v1/models
3. Chat completions (non-stream)
curl -X POST https://tokshop.xyz/v1/chat/completions \
-H "Authorization: Bearer tk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v3.2",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 100
}'4. Streaming
curl -N -X POST https://tokshop.xyz/v1/chat/completions \
-H "Authorization: Bearer tk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek/deepseek-v3.2","messages":[{"role":"user","content":"Hi"}],"stream":true}'Streaming responses include a final usage chunk; billing uses exact token counts from the provider.
5. OpenAI SDK (Python)
from openai import OpenAI
client = OpenAI(base_url="https://tokshop.xyz/v1", api_key="tk_YOUR_KEY")
r = client.chat.completions.create(
model="deepseek/deepseek-v3.2",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)6. Account & balance
curl https://tokshop.xyz/api/account -H "Authorization: Bearer tk_YOUR_KEY"
Errors
401 invalid_api_key— key missing/rotated/inactive402 insufficient_quota— balance below $0.001, top up at /pricing404 model_not_found— check GET /v1/models502 server_error— upstream failure (not billed)
Data policy
We store only metering metadata (token counts, model, timestamps). Prompt and completion contents are not persisted by TokenShop. Payments currently run in clearly-labeled TEST MODE.