Chat Completion (metered, per-subject)
OpenAI-compatible chat completion through the managed proxy, with the settled cost on the response and optional per-subject budget/rate enforcement.
http://172.16.0.1:9090, not the public api.rigbox.dev gateway. It is IP-attested — no API key; SDKs that require one can send a placeholder Authorization: Bearer managed-by-rigbox.Headers
End-user id this call's cost is attributed to. Wins over the OpenAI user body field. Trimmed; empty is treated as absent; capped at 256 characters.
"tenant-42"
At most one. Total spend cap for the subject over a rolling window: <amount>;period=<window>. <amount> is credits (a float) or a request count with a req suffix (e.g. 100req). <window> is 5h/30m/7d or a bare number of seconds. Requires X-Rigbox-Subject. A breach returns 402 subject_over_budget. Malformed → 400 subject_limit_malformed.
"50;period=30d"
May be sent multiple times. A sliding rolling-window rate limit for the subject: <amount>;window=<window> (same amount/window grammar as the budget header). Requires X-Rigbox-Subject. A breach returns 429 subject_rate_limited with a Retry-After header. Malformed → 400 subject_limit_malformed.
"5;window=1h"
Body
A standard OpenAI chat-completion request. Any OpenAI/OpenRouter field is forwarded verbatim; only the fields below are highlighted.
OpenRouter model slug — choose the upstream provider here.
"openai/gpt-4o-mini"
256
When true, the settled cost is appended to the final usage chunk (stream_options.include_usage is forced on).
false
OpenAI end-user field. Used as the subject when X-Rigbox-Subject is absent.
"tenant-42"
Response
Chat completion. Carries the settled cost in both headers and the body usage.