Skip to main content
The one endpoint behind everything: pick a model (or say auto), send messages, get the answer and the price.
POST /api/v1/chat
Response

Parameters

Multi-turn

Two ways to carry a conversation:

Vision input

Any vision-capable model accepts images by sending content as an array of parts instead of a plain string — mix text and image_url parts in one message:
image_url.url accepts a public HTTPS URL or a base64 data URL. detail is optional (auto, low, or high). Sending images to a model that isn’t vision-capable returns a model_not_vision_capable error listing which models support it.

Function calling

Pass OpenAI-style tools and NinjaChat routes the model’s tool calls back to you the same way OpenAI does — the model doesn’t execute anything itself, it just tells you what to call:
Only tool-capable models accept tools — passing them to a model that doesn’t support tool calling returns a model_not_tool_capable error.

Caching

cache: true (the default) returns identical requests instantly at no cost. Caching is automatically disabled — the request always runs live — when any of these are true:
  • session_id is set (history changes every turn)
  • stream: true
  • model is a fallback chain ("a>b>c")
  • model is an ensemble variant (ensemble, ensemble-quality)
  • Any message contains image content
  • tools is set
  • temperature is above 0.3

The model field is a superpower

Everything else about the request stays the same — only model changes:
Try any of these live in the Playground — every run shows the exact request that made it.