Gateway API

OpenAI compatibility contract

What the Gateway accepts and what it does not. Contract version 2026-10-25.

Endpoint matrix

POSThttps://www.lobstack.ai/api/gateway/v1/chat/completions
PathKindStatusContract
POST /chat/completionsOpenAI-shapedSupportedRouted chat completions, including tool calls and SSE streaming.
POST /embeddingsOpenAI-shapedSupportedOpenAI embeddings for the two listed embedding models.
GET /modelsOpenAI-shapedSupportedModel discovery with Lobstack capability and pricing extensions.
POST /route-previewGateway extensionSupportedUnauthenticated routing preview; it does not call a provider or spend tokens.
POST /searchGateway extensionSupportedLobstack web search, priced per search rather than an OpenAI operation.
POST /runs/{id}/finishGateway extensionSupportedMarks a tagged Gateway run complete.

The OpenAI-shaped surface is POST /chat/completions,POST /embeddings and GET /models./route-preview, /search and/runs/{id}/finish are Lobstack extensions, not OpenAI endpoints. The extensions use the same base URL but are not expected to work with an unmodified OpenAI resource client. Methods not listed in the matrix are outside the contract (the route returns 405), and other /v1/* resources are not implemented.

Unsupported OpenAI features

FeatureResult
POST /responsesNot implemented; do not build an integration around it.
POST /completions (legacy text completions)Not implemented; do not build an integration around it.
POST /moderationsNot implemented; do not build an integration around it.
POST /images/generationsNot implemented; do not build an integration around it.
POST /audio/speechNot implemented; do not build an integration around it.
POST /audio/transcriptionsNot implemented; do not build an integration around it.
POST /assistantsNot implemented; do not build an integration around it.
POST /threads and /runsNot implemented; do not build an integration around it.
POST /filesNot implemented; do not build an integration around it.
POST /batchesNot implemented; do not build an integration around it.
POST /fine_tuning/jobsNot implemented; do not build an integration around it.
Idempotency-Key request replay semanticsNot implemented; do not build an integration around it.

Parameter contract

Core fields are model, messages,stream, max_tokens,temperature and tools. They are validated and then forwarded or translated according to the serving model; reasoning models receive max_completion_tokens instead ofmax_tokens. Optional fields are listed below.

FieldAccepted validationProvider behaviorDrop header
userstring, at most 256 charactersCaller value is never forwarded; the Gateway supplies an HMAC identity to OpenAI.x-lobstack-dropped-params
response_formatobject with a string typeForwarded to OpenAI-compatible providers; dropped for Anthropic.x-lobstack-dropped-params
tool_choicestring or objectForwarded with tools; translated to Anthropic auto/none/any/tool with tools.x-lobstack-dropped-params
parallel_tool_callsbooleanOnly meaningful with tools; OpenAI-compatible non-OpenAI providers drop it.x-lobstack-dropped-params
top_pfinite number from 0 to 1Dropped for reasoning models and for Anthropic models that reject sampling controls.x-lobstack-dropped-params
stopstring or an array of at most 4 stringsSent as stop_sequences to Anthropic; dropped for reasoning models.x-lobstack-dropped-params
seedintegerForwarded only to OpenAI; dropped elsewhere.x-lobstack-dropped-params
presence_penaltyfinite number from -2 to 2Forwarded only to non-reasoning OpenAI models.x-lobstack-dropped-params
frequency_penaltyfinite number from -2 to 2Forwarded only to non-reasoning OpenAI models.x-lobstack-dropped-params

A valid field that cannot reach the selected provider is not silently lost: its name is included in x-lobstack-dropped-params. The caller'suser value is validated and reported as dropped; it is never forwarded. The provider receives a Gateway-generated HMAC identity instead.

Accepted by some SDKs, ignored by the Gateway

FieldBehavior
nAccepted in the JSON body but not sent upstream; no dropped-parameter header is emitted.
logprobsAccepted in the JSON body but not sent upstream; no dropped-parameter header is emitted.
top_logprobsAccepted in the JSON body but not sent upstream; no dropped-parameter header is emitted.
stream_options.include_usageAccepted in the JSON body but not sent upstream; no dropped-parameter header is emitted.
metadata (client and run fields are Gateway-only; none are forwarded)Accepted in the JSON body but not sent upstream; no dropped-parameter header is emitted.

Unknown JSON properties follow the same ignored-field rule. Malformed values for fields the Gateway reads return HTTP 400 with error_code: INVALID_PARAMETER. The Gateway does not accept an idempotency key or promise safe replay after a client retry.

Routing and model selection

auto delegates to Nex and routes within the plan ceiling. A named chat model is served exactly: response.model and x-lobstack-model are that model, including when the prompt is trivial. If it is above the plan, unavailable, or not a chat model, the request is refused. A row in GET /models means the deployment lists that model; naming it is the request for it. Embeddings are exact as well: the default or a named embedding model is never routed through Nex, and naming an embedding model on chat completions is refused. See the Nex routing documentation and model capability documentation.

SDKs and runtimes

EcosystemClient and versionsRuntimeNotes
TypeScript / JavaScriptopenai — 4.x and later Chat Completions clientsNode.js 18+ (or a runtime with fetch, Headers and ReadableStream)Use baseURL ending in /api/gateway/v1; read receipt headers with withResponse().
Pythonopenai — 1.x and later Chat Completions clientsPython 3.9+Use base_url ending in /api/gateway/v1; streamed usage is in the final chunk.
Raw HTTPcurl, requests, httpx, Go, Java, PowerShell, or equivalent — Any client that supports JSON POST and Server-Sent EventsAny runtime with TLS and HTTP/1.1+No Lobstack package is required.

These are protocol floors, not bundled dependencies. A later SDK release is compatible when it still uses the documented Chat Completions resources and does not require an unsupported OpenAI feature. Frameworks that wrap an OpenAI client inherit this same contract, including the limitation that wrappers may hide receipt headers.