Nirmos TypeScript SDK
Official, typed interface for Nirmos Gateway and managed prompts.
The Nirmos TypeScript SDK is the primary application interface for the Nirmos platform. It provides one client, stable product namespaces, normalized responses, consistent errors, streaming helpers, and production-friendly managed prompt caching.
import { Nirmos } from "@nirmos/sdk";
const nirmos = new Nirmos({
apiKey: process.env.NIRMOS_API_KEY!,
});The first release includes:
nirmos.gateway.chatfor chat completions and streamingnirmos.gateway.embeddingsfor text embeddingsnirmos.gateway.imagesfor image generationnirmos.promptsfor managed prompt creation, retrieval, rendering, versioning, activation, and caching
Future products such as agents, workflows, evaluations, observability, and vector infrastructure will use additional top-level namespaces. Existing namespaces and request patterns remain unchanged.
Why use the SDK
Calling Nirmos over raw HTTP remains possible, but the SDK handles work every application otherwise repeats:
- API-key authentication and request timeouts
- camelCase request types and normalized responses
- request, trace, provider, latency, and cache metadata
- Server-Sent Events parsing and streamed completion assembly
- stable error classes
- prompt retrieval de-duplication, TTL caching, and local rendering
- ESM and CommonJS package support with no runtime dependencies
Runtime support
The SDK supports Node.js 18 and newer. It uses the standard fetch, Response, ReadableStream, and AbortSignal APIs.
Use API keys only in trusted server environments. Do not expose a Nirmos API key in browser bundles, public environment variables, or client-side source.