Sandbox API

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.

MethodPathSummary
POST/sandbox/llm/v1/completionsCompletions

Endpoints

Completions

POST /sandbox/llm/v1/completions

Parameters

NameInTypeRequiredDescription
x-correlation-idheaderstringnoEnd-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.
Acceptheaderstring | nullno
X-Sandbox-Project-Idheaderstring | nullnoProject 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-Idheaderstring | nullnoTenant for this request. Must match the credential's tenant when the credential carries one.

Request body

application/json, required — CompletionBody

FieldTypeRequiredDescription
modelstringyes
messagesobject[]yes
temperaturenumbernoDefault: 0.
max_tokensintegernoDefault: 2048.
streambooleannoDefault: false.

Responses

StatusDescriptionBody
200Successful Responseany
422Validation ErrorHTTPValidationError

Schemas

The object shapes referenced above.

CompletionBody

FieldTypeRequiredDescription
modelstringyes
messagesobject[]yes
temperaturenumbernoDefault: 0.
max_tokensintegernoDefault: 2048.
streambooleannoDefault: false.

HTTPValidationError

FieldTypeRequiredDescription
detailValidationError[]no

ValidationError

FieldTypeRequiredDescription
locstring | integer[]yes
msgstringyes
typestringyes
inputanyno
ctxobjectno

Machine-readable spec: OpenAPI YAML.