API Documentation
Tokiq is a drop-in OpenAI-compatible API. Point your existing OpenAI client at https://api.tokiq.dev/v1 and use DeepSeek models with your Tokiq key.
https://api.tokiq.dev/v1
Authentication
Authenticate with your Tokiq API key as a Bearer token. Find your key in the dashboard after signing up.
Authorization: Bearer sk-your-tokiq-keyModels
Two models are available through the same endpoint:
| Model | Category | Context | Input (1M) | Output (1M) |
|---|---|---|---|---|
| deepseek-chat | Chat | 128K | $0.27 | $0.42 |
| deepseek-reasoner | Reasoning | 128K | $0.55 | $2.19 |
Quickstart
Install the official OpenAI SDK and point it at Tokiq:
Python
import openai
client = openai.OpenAI(
api_key="sk-your-key",
base_url="https://api.tokiq.dev/v1",
)
resp = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Explain REST in one sentence."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-key",
baseURL: "https://api.tokiq.dev/v1",
});
const resp = await client.chat.completions.create({
model: "deepseek-chat",
messages: [{ role: "user", content: "Explain REST in one sentence." }],
});
console.log(resp.choices[0].message.content);cURL
curl https://api.tokiq.dev/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'Chat Completions
POST /v1/chat/completions — the standard OpenAI chat endpoint.
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "deepseek-chat",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "REST is..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 34,
"total_tokens": 46
}
}Streaming
Set stream: true to receive tokens as server-sent events (SSE).
Python (streaming)
resp = client.chat.completions.create(
model="deepseek-reasoner",
messages=[{"role": "user", "content": "Solve 2+2 step by step."}],
stream=True,
)
for chunk in resp:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Errors
Errors use the OpenAI error shape:
{
"error": {
"message": "Budget exceeded for key",
"type": "budget_exceeded",
"param": null,
"code": "429"
}
}| Code | Meaning |
|---|---|
| 401 | Invalid or missing API key |
| 429 | Budget exceeded or rate limited |
| 400 | Malformed request body |
| 500 | Upstream model error |
Budgets & limits
Every key has a prepaid max budget. When the budget is exhausted, requests return 429. Top up from the dashboard to raise it.
Get your API key →