Nirmos
SDK reference

Gateway reference

Method signatures, parameters, responses and examples for gateway.

Use a configured server-side nirmos client from the quickstart. See the gateway guide for prerequisites and workflows. Example IDs and configured model names are placeholders; replace them with organization-visible resources before executing. Mutating calls change live resources.

HTTP calls reject with APIError subclasses on unsuccessful HTTP responses and may throw NetworkError, TimeoutError or RequestAbortedError. Signatures describe SDK values after response decoding; they are not raw HTTP envelopes. Backend validation, permissions and feature availability remain authoritative.

gateway.chat.create

Generate a normalized chat completion.

Runtime: POST /v1/chat/completions.

Credentials: Personal or service API key with the required grants.

Related guide

Types: ChatCreateParams · RequestOptions · ChatCompletion

nirmos.gateway.chat.create(
  params: ChatCreateParams,
  options?: RequestOptions | undefined
): Promise<ChatCompletion>
ParameterRequiredType / default
paramsYesChatCreateParams
optionsNoRequestOptions | undefined

Request fields

Choose one of these source-defined alternatives; requirements apply within each alternative.

Alternative 1

FieldRequiredType
conversationNo{ id: string; } | undefined
memoryNo{ enabled: false; } | undefined
privacyNoChatCreateParams["privacy"]
messagesNoreadonly ChatMessage[] | undefined
promptNoPromptReference | undefined
temperatureNonumber | undefined
topPNonumber | undefined
maxOutputTokensNonumber | undefined
stopNostring | readonly string[] | undefined
toolsNoreadonly FunctionTool[] | undefined
toolChoiceNoToolChoice | undefined
responseFormatNoResponseFormat | undefined
seedNonumber | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
fallbackModelsNoreadonly string[] | undefined
routingStrategyNoRoutingStrategy | undefined
metadataNoReadonly<Record<string, JsonValue>> | undefined
modelYesstring
routeNoundefined

Alternative 2

FieldRequiredType
conversationNo{ id: string; } | undefined
memoryNo{ enabled: false; } | undefined
privacyNoChatCreateParams["privacy"]
messagesNoreadonly ChatMessage[] | undefined
promptNoPromptReference | undefined
temperatureNonumber | undefined
topPNonumber | undefined
maxOutputTokensNonumber | undefined
stopNostring | readonly string[] | undefined
toolsNoreadonly FunctionTool[] | undefined
toolChoiceNoToolChoice | undefined
responseFormatNoResponseFormat | undefined
seedNonumber | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
fallbackModelsNoreadonly string[] | undefined
routingStrategyNoRoutingStrategy | undefined
metadataNoReadonly<Record<string, JsonValue>> | undefined
routeYesstring
modelNoundefined

Returns: ChatCompletion.

Behavior: Provide exactly one model or route and nonempty messages after prompt rendering. Tools are returned to your application; the SDK does not execute them. Provider capability checks remain server-side.

Example

const result = await nirmos.gateway.chat.create({
  "model": "configured/chat-model",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
});

gateway.chat.stream

Stream chat events and assemble a final completion.

Runtime: POST /v1/chat/completions.

Credentials: Personal or service API key with the required grants.

Related guide

Types: ChatCreateParams · RequestOptions · ChatStream

nirmos.gateway.chat.stream(
  params: ChatCreateParams,
  options?: RequestOptions | undefined
): Promise<ChatStream>
ParameterRequiredType / default
paramsYesChatCreateParams
optionsNoRequestOptions | undefined

Request fields

Choose one of these source-defined alternatives; requirements apply within each alternative.

Alternative 1

FieldRequiredType
conversationNo{ id: string; } | undefined
memoryNo{ enabled: false; } | undefined
privacyNoChatCreateParams["privacy"]
messagesNoreadonly ChatMessage[] | undefined
promptNoPromptReference | undefined
temperatureNonumber | undefined
topPNonumber | undefined
maxOutputTokensNonumber | undefined
stopNostring | readonly string[] | undefined
toolsNoreadonly FunctionTool[] | undefined
toolChoiceNoToolChoice | undefined
responseFormatNoResponseFormat | undefined
seedNonumber | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
fallbackModelsNoreadonly string[] | undefined
routingStrategyNoRoutingStrategy | undefined
metadataNoReadonly<Record<string, JsonValue>> | undefined
modelYesstring
routeNoundefined

Alternative 2

FieldRequiredType
conversationNo{ id: string; } | undefined
memoryNo{ enabled: false; } | undefined
privacyNoChatCreateParams["privacy"]
messagesNoreadonly ChatMessage[] | undefined
promptNoPromptReference | undefined
temperatureNonumber | undefined
topPNonumber | undefined
maxOutputTokensNonumber | undefined
stopNostring | readonly string[] | undefined
toolsNoreadonly FunctionTool[] | undefined
toolChoiceNoToolChoice | undefined
responseFormatNoResponseFormat | undefined
seedNonumber | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
fallbackModelsNoreadonly string[] | undefined
routingStrategyNoRoutingStrategy | undefined
metadataNoReadonly<Record<string, JsonValue>> | undefined
routeYesstring
modelNoundefined

Returns: ChatStream.

Behavior: Consume once. Wait for iteration to finish before finalResponse(). Early loop exit cancels the body and does not produce a final completion. Stream consumption is not retried.

Example

const result = await nirmos.gateway.chat.stream({
  "route": "production-chat",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
});

gateway.embeddings.create

Embed text with a directly selected physical model.

Runtime: POST /v1/embeddings.

Credentials: Personal or service API key with the required grants.

Related guide

Types: EmbeddingCreateParams · RequestOptions · EmbeddingResponse

nirmos.gateway.embeddings.create(
  params: EmbeddingCreateParams,
  options?: RequestOptions | undefined
): Promise<EmbeddingResponse>
ParameterRequiredType / default
paramsYesEmbeddingCreateParams
optionsNoRequestOptions | undefined

Request fields

FieldRequiredType
modelYesstring
inputYesstring | readonly string[]
dimensionsNonumber | undefined
encodingNo"float" | "base64" | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
fallbackModelsNoreadonly string[] | undefined
routingStrategyNoRoutingStrategy | undefined

Returns: EmbeddingResponse.

Behavior: fallbackModels and routingStrategy remain in the type but are deprecated and rejected by runtime. Dimensions and encoding depend on provider support.

Example

const result = await nirmos.gateway.embeddings.create({
  "model": "configured/embedding-model",
  "input": [
    "Support policy"
  ]
});

gateway.images.generate

Generate images through the legacy normalized SDK interface.

Runtime: POST /v1/images/generations.

Credentials: Personal or service API key with the required grants.

Related guide

Types: ImageGenerateParams · RequestOptions · ImageGeneration

nirmos.gateway.images.generate(
  params: ImageGenerateParams,
  options?: RequestOptions | undefined
): Promise<ImageGeneration>
ParameterRequiredType / default
paramsYesImageGenerateParams
optionsNoRequestOptions | undefined

Request fields

FieldRequiredType
storageNo{ mode: "transient" | "temporary" | "persistent"; ttlSeconds?: number | undefined; } | undefined
modelYesstring
promptYesstring
countNonumber | undefined
outputCompressionNonumber | undefined
safetyIdentifierNostring | undefined
moderationNo"auto" | "low" | undefined
sizeNoImageSize | undefined
qualityNoExtensibleString<"auto" | "low" | "standard" | "hd" | "medium" | "high"> | undefined
styleNoExtensibleString<"natural" | "vivid"> | undefined
formatNoExtensibleString<"png" | "jpeg" | "webp"> | undefined
responseFormatNo"base64" | "url" | undefined
backgroundNoExtensibleString<"auto" | "transparent" | "opaque"> | undefined
userNostring | undefined
providerNostring | undefined
providerOptionsNoReadonly<Record<string, Readonly<Record<string, JsonValue>>>> | undefined
metadataNoReadonly<Record<string, JsonValue>> | undefined

Returns: ImageGeneration.

Behavior: Legacy camel-case parameters and normalized images remain supported. Use images.generate for the standard OpenAI response. Image POST requests never retry automatically.

Example

const result = await nirmos.gateway.images.generate({
  "model": "openai/gpt-image-2.5-flare",
  "prompt": "A modern electric motorcycle",
  "count": 1
});

On this page