Burn

OpenAI-compatible metered chat completions

Accepts the OpenAI Chat Completions request shape. With stream=true, returns provider-native SSE without full-response buffering. Locus captures the fixed authorized charge before delivering the first byte.

post/wrapped/credits/v1/chat/completions

Request

  • Base URL
    https://api.paywithlocus.com/api
  • URL
    https://api.paywithlocus.com/api/wrapped/credits/v1/chat/completions
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Headers

X-Locus-Session-Idstring

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.

Idempotency-Keystring required

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

X-Locus-End-Userstring

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

X-Locus-Agent-Loop-Idstring

Required when this user's policy sets maxCallsPerLoop.

Request body

modelstring required
messagesobject[] required
streamboolean
stream_optionsobject
max_tokensinteger
max_completion_tokensinteger

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.

toolsobject[]
tool_choiceunknown

Response

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

object required

Changes

No recorded changes to this operation across all 1 revision of this API.