Quickstart
Every DeepToken endpoint is OpenAI-compatible. If you already have working OpenAI code, you only need to change two lines: the base URL and the API key.
Code Examples
Select your language of choice to initialize the client and make a request:
from openai import OpenAI
client = OpenAI(
api_key="$DEEPTOKEN_API_KEY",
base_url="https://api.deeptoken.app/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hi"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai"
const client = new OpenAI({
apiKey: process.env.DEEPTOKEN_API_KEY,
baseURL: "https://api.deeptoken.app/v1",
})
const completion = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hi" }],
})
curl https://api.deeptoken.app/v1/chat/completions \
-H "Authorization: Bearer $DEEPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say hello in one sentence."}]
}'
Streaming
Pass stream: true for an SSE stream. Streaming is metered on the same path as non-streaming requests β every token is counted, every call lands in the usage ledger.
Other endpoints
The gateway routes all common OpenAI-compatible endpoints:
POST /v1/chat/completionsPOST /v1/completionsPOST /v1/embeddingsPOST /v1/moderationsPOST /v1/images/generationsPOST /v1/audio/speechPOST /v1/audio/transcriptionsPOST /v1/audio/translationsGET /v1/models
Pick the model in the request body; the gateway picks the channel.