/chat/completions endpoint. Point any
OpenAI SDK at NinjaChat by setting two things:
- Base URL:
https://www.ninjachat.ai/api/v1 - API key: your
nj_sk_...key
Starting a new integration? The official NinjaChat SDKs add typed routing, images, video polling, usage, request traces, and webhook helpers. Keep the OpenAI SDK when you want the smallest possible migration.
Env-var setup
The OpenAI SDKs also pick upOPENAI_API_KEY and OPENAI_BASE_URL from the
environment, so you can skip the constructor arguments entirely:
Python
What works
- Any model — pass any model ID, or
ninja/autoto let NinjaChat pick. - Streaming — set
stream: truefor token-by-token server-sent events. - Tool calling — standard
tools/tool_choicewithfunction.parameters. - Sampling —
temperature,top_p,max_tokens(ormax_completion_tokens),stop,seed,frequency_penalty,presence_penalty.
/api/v1/chat/completions is the OpenAI-compatible message interface. For new native integrations, use /api/v1/responses; both share authentication, routing, and billing.What’s rejected
The request schema is strict. Standard OpenAI SDK fields that have no effect on NinjaChat are dropped silently; anything that would change the meaning of the request fails with a400 instead of being ignored:
NinjaChat extras
The native Responses API adds optional features OpenAI doesn’t have — smart routing, fallbacks, spend controls, explicit provider policy, and per-responsecost_usd
and request traces. Adopt the official NinjaChat SDK when you need those typed primitives.