LLM
One-shot chat completions (JSON or SSE). Keys from KeyHive leases when SANDBOX_LLM_EGRESS=direct, or LLM Gateway M2M when gateway.
One-shot chat completions (JSON or SSE). Keys from KeyHive leases when SANDBOX_LLM_EGRESS=direct, or LLM Gateway M2M when gateway.
Every request needs a credential — see Authentication.
| Method | Path | Summary |
|---|---|---|
POST | /sandbox/llm/v1/completions | Completions |
Endpoints
Completions
POST /sandbox/llm/v1/completions
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
x-correlation-id | header | string | no | End-to-end correlation id for this eval run. When set, the gateway and downstream services honor it verbatim in logs, Cloud Trace span attributes, async job payloads, and Langfuse trace.id. When omitted, the gateway generates a ULID and echoes it on the response. |
Accept | header | string | null | no | |
X-Sandbox-Project-Id | header | string | null | no | Project to bill and rate-limit this request against. Validated against the credential: a project-scoped token may only name its own project, and gets 403 otherwise. Defaults to the token's project when omitted. |
X-Sandbox-Tenant-Id | header | string | null | no | Tenant for this request. Must match the credential's tenant when the credential carries one. |
Request body
application/json, required — CompletionBody
| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | |
messages | object[] | yes | |
temperature | number | no | Default: 0. |
max_tokens | integer | no | Default: 2048. |
stream | boolean | no | Default: false. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Successful Response | any |
422 | Validation Error | HTTPValidationError |
Schemas
The object shapes referenced above.
CompletionBody
| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | |
messages | object[] | yes | |
temperature | number | no | Default: 0. |
max_tokens | integer | no | Default: 2048. |
stream | boolean | no | Default: false. |
HTTPValidationError
| Field | Type | Required | Description |
|---|---|---|---|
detail | ValidationError[] | no |
ValidationError
| Field | Type | Required | Description |
|---|---|---|---|
loc | string | integer[] | yes | |
msg | string | yes | |
type | string | yes | |
input | any | no | |
ctx | object | no |
Machine-readable spec: OpenAPI YAML.