Comparisons
Choose between direct provider SDKs, the OpenAI SDK, the Nirmos SDK, and gateway routing.
Nirmos does not replace every provider feature or client library. It provides a gateway boundary when an application benefits from a stable request surface across providers and centrally managed routing.
| Approach | Best fit | Trade-off |
|---|---|---|
| Provider API directly | You need a provider-specific feature or native response shape. | Provider changes and fallback logic live in application code. |
| Provider-specific SDK | You want the provider's complete typed API and helpers. | Each provider introduces a different client and contract. |
| OpenAI SDK through Nirmos | Your code already uses OpenAI-compatible chat, streaming, models, or embeddings. | Nirmos-specific managed prompts are not exposed through the OpenAI client. |
| Nirmos SDK | You want typed gateway calls, normalized metadata/errors, stream assembly, and managed prompts. | It intentionally exposes the Nirmos surface, not every provider-native endpoint. |
| Nirmos route | Provider/model choice and fallback should be centrally configured. | A route must be created and activated before its slug can be called. |
Direct providers or Nirmos
Call a provider directly when the application depends on an endpoint or parameter the Nirmos gateway does not implement. Put Nirmos in the request path when the implemented common contract is sufficient and central routing, fallback, caching, or request traces are useful.
Nirmos still needs configured provider credentials and models. It does not make a provider capability available when the underlying model or adapter does not support it.
OpenAI SDK or Nirmos SDK
Both can call the OpenAI-compatible gateway surface:
const completion = await nirmos.gateway.chat.create({
model: "openai/gpt-5.4-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.outputText);const completion = await client.chat.completions.create({
model: "openai/gpt-5.4-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0]?.message.content);Choose the Nirmos SDK if the same integration also uses managed prompts:
await nirmos.gateway.chat.create({
route: "support",
prompt: {
id: "support-reply",
variables: { customerName: "Asha" },
},
messages: [{ role: "user", content: ticket.body }],
});There is no equivalent managed-prompt method in the OpenAI SDK.
Model or route
- Use
model: "openai/gpt-5.4-mini"for a direct, provider-qualified model. - Use
route: "production-chat"with the Nirmos SDK when selection belongs in Nirmos. - Use
model: "nirmos/production-chat"with an OpenAI-compatible client for the same route.
Read Routing and fallback for the exact resolution rules.