v1

latestOpenAPI 3.1.0Apache-2.02026-07-13153158.0 KB
openai-compat

OpenAI-compatible text completions (T41 wired)

Accepts the public OpenAI POST /v1/completions request shape and dispatches to the deployed function the gateway operator has aliased to the requested model (via TENSOR_WASM_API_OPENAI_MODEL_MAP). Returns the standard OpenAI text_completion envelope on success, or 404 model_not_found when the model alias is unknown.

When stream: true, returns text/event-stream with one data: { ... } SSE frame per emitted chunk and a terminal data: [DONE]\n\n line.

The X-TensorWasm-Tenant header is not honoured on this route, because OpenAI SDKs never send it. Tenant resolution comes from the bearer token's scope (see docs/OPENAI-COMPAT.md).

post/v1/completions

Request body

modelstring

Model identifier. The gateway operator pre-aliases this to a deployed function UUID via TENSOR_WASM_API_OPENAI_MODEL_MAP. Unknown ids surface as 404 model_not_found.

{"stackTrail":"components:schemas:CompletionsRequest:properties:prompt","oasType":"schema","type":"unknown","description":"Prompt text. Accepts either a single string or an array of\nstrings; arrays are joined with newlines before dispatch.\n"}
max_tokensinteger
temperaturenumber
streamboolean

When true the response is text/event-stream with one data: { ... } SSE frame per emitted chunk and a terminal data: [DONE]\n\n line.

echoboolean
ninteger
userstring

Response

Completion result (or SSE stream when stream:true).

idstring required
object'text_completion' required
createdinteger required

Unix seconds at which the response was generated.

modelstring required

Echoes the request's model field.