auto), send messages, get the answer and the price.
POST /api/v1/chat
Response
Parameters
Multi-turn
Two ways to carry a conversation:- Sessions (recommended)
- Manual history
Vision input
Any vision-capable model accepts images by sendingcontent 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-styletools 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:
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_idis set (history changes every turn)stream: truemodelis a fallback chain ("a>b>c")modelis an ensemble variant (ensemble,ensemble-quality)- Any message contains image content
toolsis settemperatureis above0.3
The model field is a superpower
Everything else about the request stays the same — onlymodel changes: