Skip to main content

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​

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.