How to use TokenBaazar

Copy-paste recipes for every model — chat, streaming, vision, images, TTS, STT, embeddings.

Simple chat completion

Basic Q&A / assistant reply — the most common call. Works with every GPT / Gemini text model.

openai/gpt-5.5openai/gpt-5.4-minigoogle/gemini-3.6-flashgoogle/gemini-3.1-pro-preview
Pre-made prompt
You are an expert full-stack app builder like Lovable / Bolt / Replit. When the user describes an app idea, respond with: 1) a short product summary, 2) tech stack (React + Vite + Tailwind + Supabase), 3) file tree, 4) full production-ready code for every file in fenced code blocks. Use TypeScript, shadcn/ui, clean semantic design tokens — no inline styles, no placeholders, no TODOs.
tokenbaazar — curl
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."}
    ]
  }'

Full API reference

Base URL & OpenAI compatibility

All endpoints are OpenAI-compatible. Point any OpenAI SDK at:

https://tokenbaazar.in/api/public/v1

Works 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.

Authentication

Send your TokenBaazar key as a Bearer token:

Authorization: Bearer tb_live_xxxxxxxxxxxxxxxxxxxx

Create keys at /keys. Each key can be locked to specific models and given a per-minute spending cap.

Endpoints

  • POST /v1/chat/completions — chat + streaming + vision + tools
  • POST /v1/images/generations — image generation
  • POST /v1/audio/speech — text-to-speech
  • POST /v1/audio/transcriptions — speech-to-text
  • POST /v1/embeddings — vector embeddings
  • GET /v1/models — list all available models
  • GET /v1/balance — remaining wallet balance (paise)

Streaming

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.

Tool calling & vision

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.

Pricing & billing

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.

Rate limits

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.

Error codes

  • 401 — invalid or revoked API key
  • 402 — wallet balance exhausted → top up at /topup
  • 403 — key not allowed to use this model
  • 429 — per-minute spending cap hit (wait N seconds)
  • 5xx — upstream provider error, auto-retried on a healthy key

Security

API 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.

Model catalog

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.