Completions
Generates text that continues a prompt. The request and response follow the OpenAI Completions format. The gateway meters it like a chat request and forwards the body to the model server. For conversations and tool calling, use Chat completions.
/completionshttps://api.bricksum.com/v1/completionsAuthentication
Authentication is the same on every endpoint the gateway fronts, and is documented on the API Reference page.
Request body
Support status
- supported
- The gateway handles it, or a published measurement shows it works.
- passed through
- Forwarded to the model server; not verified by Kiln.
- ignored
- Accepted with 200, but not applied. The rest of the response is normal.
- not supported
- Rejected with an error, or not working on the models named in the description.
Common parameters
These are documented once on the API Reference page. Listed here with what this endpoint does differently.
modelstringrequiredsupportedSame as the shared definition.
max_tokensintegerpassed throughForwarded to the model server; not verified by Kiln.
streambooleansupportedThe gateway also reads the string "true" and the number 1 as true, and rewrites the field to a boolean before forwarding. Use stream_options below to keep the usage chunk.
- Default
- false
Only on this endpoint
promptstring | arrayrequiredsupportedThe text to continue. The gateway forwards the value unchanged and does not validate it.
stream_optionsobjectsupportedOptions for a streaming response. Send it only together with stream: true.
usage options
include_usagebooleansupportedWhen true, the stream ends with one extra chunk whose choices is empty and whose usage object holds the token counts and cost. The gateway sets this flag on every streaming request to meter tokens, and removes the usage chunk when you did not ask for it.
- Default
- false
temperaturenumberpassed throughForwarded to the model server; not verified by Kiln.
- Range
- 0–2
top_pnumberpassed throughForwarded to the model server; not verified by Kiln.
- Range
- 0–1
nintegerpassed throughForwarded to the model server; not verified by Kiln.
seedintegerpassed throughForwarded to the model server; not verified by Kiln.
stopstring | arraypassed throughForwarded to the model server; not verified by Kiln.
presence_penaltynumberpassed throughForwarded to the model server; not verified by Kiln.
- Range
- -2–2
frequency_penaltynumberpassed throughForwarded to the model server; not verified by Kiln.
- Range
- -2–2
logprobsintegerpassed throughForwarded to the model server; not verified by Kiln.
echobooleanpassed throughForwarded to the model server; not verified by Kiln.
ignore_eosbooleanpassed throughForwarded to the model server; not verified by Kiln. The 400 (unsupported_parameter) check for gpt-oss models applies to /chat/completions only.
OpenAI Completions parameters that are not listed here are forwarded to the model server in the same way. Kiln has not verified them.
Response body
| Field | Type | Description |
|---|---|---|
| id | string | ID of the completion. |
| object | string | "text_completion". |
| choices[]. | string | The generated text. |
| choices[]. | string | "stop" or "length" (cut off by max_tokens). |
| usage. | integer | Input tokens. |
| usage. | integer | Output tokens, including reasoning tokens. |
| usage. | integer | Input plus output tokens. |
| usage. | integer | Input tokens served from the prefix cache. Present only when the model server reports it. |
| usage. | number | Amount in USD deducted from credits for this request. The gateway adds it. |
| X-Neocloud-Generation-Id | header | Response header with the ID of the usage event for this request. Store it with your logs. |
Stream chunk
With stream: true, each data: line carries one chunk with the fields below. Keepalive comments, data: [DONE] and disconnects are described on the Streaming page.
| Field | Type | Description |
|---|---|---|
| choices[]. | string | The new text of this chunk. |
| choices[]. | string | null | null until the last content chunk, which carries the reason. |
| usage | object | Only in the final chunk, and only when stream_options.include_usage is true. That chunk has an empty choices array. |
| usage. | number | Amount in USD deducted from credits for this request. The gateway adds it to the usage chunk. |
Errors
Branch on the HTTP status and error.code, not on the message text. An empty error.code cell means the body carries no code. Every status code is listed on the Errors page.
| Status · error.code | Cause | What to do |
|---|---|---|
| 400 | The model server rejected the request: malformed JSON, invalid parameters, or more than the model's context window (the Models page lists it per model). | Fix the payload. Do not retry as sent. |
| 404model_not_found | The model ID is not in the catalog. | Check the ID against GET /models. |
| 429rate_limit_exceeded | The organization already has 8 requests in flight. No rate-limit headers are sent. | Back off exponentially and retry. |
| 502 | The model backend returned an error or was unreachable. The body is plain text. | Retry with exponential backoff. |
| 503 | The service is in maintenance mode, or no model backend is available. | During maintenance, wait until the Retry-After date. Otherwise retry with exponential backoff. |
401, 402, 403 and 429 come from the gateway before the request reaches this endpoint. They are listed once on the API Reference page.
Limits
Context length, request body size, timeouts and the per-organization rate limits apply here as well; they are listed once on the API Reference page.
Headers and retry guidance for 429 are on the Rate limits page.