Skip to main content
1

Get your API key

Head to your NinjaChat Developer Settings and generate a new API key.
2

Set up your API key

Add your API key to your environment. You’ll reference it in every request.
export NINJACHAT_API_KEY='nj_sk_your-api-key-here'
Or add it to a .env file in your project:
NINJACHAT_API_KEY=nj_sk_your-api-key-here
3

Make your first request

Send a message to any model. Set model to auto and NinjaChat picks the best one for you.
curl -X POST https://ninjachat.ai/api/v1/chat \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $NINJACHAT_API_KEY" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "What is the capital of France?"}]
  }'
4

Get your response

Every response tells you which model ran, what it cost, and your remaining balance.
{
  "model": "gemini-3-flash",
  "choices": [{
    "message": { "role": "assistant", "content": "The capital of France is Paris." },
    "finish_reason": "stop"
  }],
  "cost": { "this_request": "$0.003" },
  "balance": "$49.997",
  "metadata": { "latency_ms": 312 }
}
model: "auto" routed this to gemini-3-flash — the fastest option for short factual questions.

Next steps

Smart Routing

Auto-select the best model for each prompt

Model Compare

Benchmark models side-by-side

Batch

Run up to 20 prompts in parallel

Sessions

Build multi-turn conversations

Images

Generate images with 13 models

All Models

See every available model