Copy-paste recipes for every model — chat, streaming, vision, images, TTS, STT, embeddings.
Basic Q&A / assistant reply — the most common call. Works with every GPT / Gemini text model.
curl https://tokenbaazar.in/api/public/v1/chat/completions \
-H "Authorization: Bearer sk-tb-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in 2 lines for a 12-year-old."}
]
}'All endpoints are OpenAI-compatible. Point any OpenAI SDK at:
https://tokenbaazar.in/api/public/v1Works with the official OpenAI SDKs (Python, Node, Go, Rust), LangChain, LlamaIndex, Vercel AI SDK, Continue.dev, Cursor, and any tool that accepts a custom base_url.
Send your TokenBaazar key as a Bearer token:
Authorization: Bearer tb_live_xxxxxxxxxxxxxxxxxxxxCreate keys at /keys. Each key can be locked to specific models and given a per-minute spending cap.
POST /v1/chat/completions — chat + streaming + vision + toolsPOST /v1/images/generations — image generationPOST /v1/audio/speech — text-to-speechPOST /v1/audio/transcriptions — speech-to-textPOST /v1/embeddings — vector embeddingsGET /v1/models — list all available modelsGET /v1/balance — remaining wallet balance (paise)Add stream: true to any chat request. Response is Server-Sent Events (SSE) — identical format to OpenAI. Every SDK's streaming helpers work out of the box.
Pass tools and tool_choice exactly like OpenAI. For vision, send image parts in the message content array: { type: "image_url", image_url: { url } }. Supported on all GPT-5.x and Gemini 2.5+ models.
Every model runs at 60% off its real market price. Charges are per token (input + output separately), settled in paise from your wallet the moment a request completes.
Your dashboard shows Spent vs Market — the market column is what you'd have paid on OpenAI / Anthropic directly.
Each key has a per-minute paise cap you set yourself. Exceed it and the API returns 429 with a message like "Please wait 8s". No token-per-minute limit — only spend-per-minute.
401 — invalid or revoked API key402 — wallet balance exhausted → top up at /topup403 — key not allowed to use this model429 — per-minute spending cap hit (wait N seconds)5xx — upstream provider error, auto-retried on a healthy keyAPI keys are hashed with a server-side pepper before storage — only the prefix (tb_live_abcd…) is ever shown after creation. Revoke instantly from /keys; the cache is invalidated the same request so a revoked key stops working immediately.
Call GET /v1/models for the live list, or browse pricing on the home page. Covers GPT-5.x, GPT-5.6 family, Gemini 2.5 / 3.x (Flash, Pro, Image), DALL-E, TTS voices, and Whisper.