Skip to main content
OpenAIClaudeGeminiDeepSeekQwen
NinjaChat has two text APIs on the same model network. Responses is recommended for new applications; Chat Completions is the OpenAI-compatible interface for role-based messages.

Start with Responses

Best for new text, vision, tools, structured output, and typed streaming integrations.

Keep Chat Completions

Best when your application already uses OpenAI-style role messages or an OpenAI client.

Responses API

Chat Completions

Parameters

The two endpoints share routing, billing, and most sampling controls, but not every field exists on both. The API column says where a parameter is accepted; sending a field to the other endpoint returns 400 unsupported_parameter.

Spend cap

routing.max_cost_usd is checked twice. Before any provider call the gateway computes the maximum token hold — your input estimate plus the output ceiling at the candidate models’ metered rates — and rejects the request with 400 max_cost_exceeded (the body includes maximum_hold_usd) if that hold is above the cap. At settle time the metered charge is capped at max_cost_usd; usage priced above it is absorbed by NinjaChat, never billed to you. See Spend controls.

Structured output

Ask for JSON with response_format (Chat Completions) or text.format (Responses). json_object returns any valid JSON; json_schema constrains it to your schema (strict defaults to true). Models without JSON mode return 400 model_not_json_capable — filter on the json_mode capability in GET /models.

Multi-turn conversations

Two ways to carry a conversation:
Send the conversation items your application stores. NinjaChat API v1 is stateless and does not retain response bodies.
State management →

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. On /responses the definition is flat (no function wrapper) and tool_choice names the function directly:
The same forced choice on Chat Completions is {"type": "function", "function": {"name": "get_weather"}}. Tool calls come back as function_call output items on Responses and as tool_calls on Chat Completions; send results back as function_call_output input items or tool messages respectively. Only function tools are supported — a built-in tool type returns 400 unsupported_tool.

Routing is explicit

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