Skip to main content
POST
OpenAI-compatible metered chat completions

Authorizations

Authorization
string
header
required

Tenant secret key (lcr_…). Server-side only.

Headers

X-Locus-Session-Id
string

Required only when the end-user JWT carries sid. Send the original high-entropy session value; sid is its SHA-256 fingerprint. Ignored for secret-key authentication.

Required string length: 16 - 128
Pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]{15,127}$
Idempotency-Key
string
required

One key per model request body; reuse it on an identical retry.

X-Locus-End-User
string

Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.

Required string length: 1 - 200
Pattern: ^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,199}$
X-Locus-Agent-Loop-Id
string

Required when this user's policy sets maxCallsPerLoop.

Maximum string length: 200

Body

application/json
model
string
required
messages
object[]
required
Minimum array length: 1
stream
boolean
default:false
stream_options
object
max_tokens
integer
Required range: x >= 1
max_completion_tokens
integer

For reviewed reasoning models, an explicit value must be at least that model's recommendedMinOutputTokens (currently 4000); smaller budgets are rejected before dispatch or billing because hidden reasoning can exhaust the budget before visible output.

Required range: x >= 1
tools
object[]
tool_choice
any

Response

OpenAI JSON response, or unbuffered OpenAI SSE when stream=true

The response is of type object.