1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Keep Your OpenAI SDK: The Compatible Endpoint Surface, Endpoint by Endpoint

1
Posted at

An OpenAI-compatible API is useful because the surface is familiar. But "familiar" is not the same as "identical everywhere." This is the endpoint surface documented for nRouter, with the per-model checks that matter before production.

The connection

Two values change: a virtual key stored as NROUTER_API_KEY, and the base URL https://api.nrouter.ai/v1. Your OpenAI SDK, message format, and streaming code carry over.

The endpoints

  • /v1/chat/completions — chat and streaming completions in the OpenAI request format. Add stream: true for server-sent event chunks.
  • /v1/models — model discovery; returns the live catalogue surface used to verify IDs and capabilities.
  • /v1/embeddings — embeddings, where the selected embedding model and provider support the endpoint.
  • /v1/images — image generation, where supported by the selected model and provider.
  • /v1/audio and /v1/videos — audio operations and video jobs, where supported; check the API reference for request and polling behavior.

Every "where supported" above is load-bearing. Availability depends on the selected model — verify against the catalogue and the API reference, not assumptions.

The checks before production

  1. Verify the model ID exists in the live catalogue and supports your endpoint.
  2. Test tool calling and JSON mode on the exact model — support varies by provider.
  3. Test streaming error handling: a stream that has started does not transparently replay to another provider.
  4. Configure budgets and guardrails (PII redaction, prompt-injection detection) at the gateway layer.
  5. Confirm cost records attribute each request to its provider and model.

The reference point for all of the above: OpenAI-compatible LLM API.

Disclosure: I work with the nRouter team.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?