Skip to main content
NinjaChat exposes an OpenAI-compatible /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
Everything else — request shape, streaming, tool calls, and error format — matches the OpenAI API.

What works

  • Any model — pass any model ID, or auto to let NinjaChat pick.
  • Streaming — set stream: true for token-by-token server-sent events.
  • Tool calling — standard tools / tool_choice with function.parameters.
  • Samplingtemperature, top_p, max_tokens (or max_completion_tokens), stop, seed, frequency_penalty, presence_penalty.
Both /api/v1/chat/completions (OpenAI-style) and /api/v1/chat (native) accept the same request and return the same response. Use whichever your tooling expects.

NinjaChat extras

The native /chat endpoint adds optional features OpenAI doesn’t have — smart routing, fallback chains, budget routing, sessions, and per-response cost and balance. They’re ignored by the OpenAI SDK, so you can adopt them gradually.