Nirmos
Resources

Errors and response contracts

Distinguish SDK return values from HTTP envelopes and application failures.

SDK calls and HTTP paths

Methods append their own /v1/... paths to the configured origin. Management uses apiBaseUrl; execution uses runtimeBaseUrl. Keep /v1 out of base URLs and retain any deployment-specific path prefix.

SDK gateway requests use camelCase and map to wire fields. Management DTOs retain their declared field names. Gateway replies normalize to ChatCompletion / EmbeddingResponse; endpoint execution and prompt testing retain their explicit response contracts. Management calls unwrap { data } and return the inner value.

Identifiers

Catalog IDs connect related resources. Inference usually selects provider-qualified model names. Route requests accept IDs/slugs. Managed prompt identifiers accept IDs/slugs plus numeric/active/latest content versions; management prompt versions use string IDs. Do not use a catalog model ID in a field expecting a provider-qualified name without confirming that endpoint's resolution contract.

Request options

await nirmos.gateway.chat.create({
  route: "production-chat",
  messages: [{ role: "user", content: "Hello" }],
}, { timeoutMs: 10_000, maxRetries: 0, headers: { "Nirmos-UserId": "customer_123" } });

Use RequestOptions.signal for cancellation, timeoutMs for a per-attempt budget, and headers for supported attribution. idempotencyKey only enables retry eligibility where server deduplication is implemented. See configuration for argument ordering exceptions.

Data and metadata

Management dates remain ISO strings. Missing/nullable DTO fields are distinct; broad response contracts require guards. Gateway metadata may include requestId, traceId, provider, model, latencyMs and cache status/layer/remainingTtlSeconds. These fields are optional because not every endpoint/deployment emits or exposes them.

SDK response decoding is not a universal runtime schema validator. Validate unknown application outputs. A successful HTTP response can still include feature-level failure/validation fields. See errors, types and REST reference.

Application outcomes

Endpoint execution retains fields such as data.output_valid and meta.request_id. Its result is not a ChatCompletion.

Inspect document indexing status, evaluation trial/score failures, prompt-test success, and endpoint output validity even when HTTP succeeds. A resolved promise alone does not establish a successful domain outcome. Error handling covers transport failures; each method reference owns its return contract.

On this page