Create a governed chat completion
POST/gw/:token/v1/chat/completions
Send an OpenAI chat-completions request. The body is forwarded to your provider unchanged. Streaming ("stream": true) is supported.
If the request is blocked, you receive a normal completion containing the refusal message, HTTP 200 and X-Bairav-Blocked: 1.
Other outcomes: 400 when messages is missing, 401 for an invalid or revoked gateway key, 502 when your provider cannot be reached.
Request
Responses
- 200
- 400
- 401
- 502
A completion from your provider, or a refusal from Bairav (check X-Bairav-Blocked).
Response Headers
X-Bairav-Blocked
Present with the value 1 when Bairav blocked the call and the body is a refusal.
The request has no messages array.
The gateway key is invalid or revoked.
The upstream provider could not be reached.