Gateway

Chat completions

OpenAI-compatible chat completions through the Guardion Gateway. Same request and response shape as the OpenAI Chat Completions API; guardrails run inline. If a guardrail blocks under a block config, the gateway returns the Guardion verdict instead of the model output.

POST/v1/chat/completions

How to use the Gateway

The Guardion Gateway is an OpenAI-compatible reverse proxy that runs your guardrails inline on every LLM call. Point your existing OpenAI/Anthropic SDK at the gateway base URL, add two headers, and every request is evaluated before it reaches the provider (and the response on the way back).

The gateway always forwards your own provider key to the LLM — Guardion never stores it. It only authenticates you (x-guardion-api-key) and applies the guardrail policy (x-guardion-policy).

Base URL
https://gateway.guardion.ai

Headers

x-guardion-api-keystringrequired

Your Guardion API key (authenticates against Guard).

Authorizationstringrequired

Your own provider key, e.g. Bearer sk-..., forwarded to the provider as-is.

x-guardion-policystring

Policy slug that loads guardrail definitions (controls guardrails, not routing).

x-guardion-providerstring

LLM provider (e.g. openai, anthropic). Inferred from the model prefix if omitted.

Body Parameters

modelstringrequired

Model id, e.g. gpt-4o.

messagesMessage[]required

Chat messages (OpenAI format).

...any

Any other OpenAI Chat Completions parameter (temperature, stream, tools, …).

Response

idstring

Completion id.

objectstring

Always "chat.completion".

choicesChoice[]

Standard OpenAI choices. When a guardrail blocks, the gateway returns the Guardion verdict (flagged labels + correction) instead of the model completion.

usageUsage

Token usage: { prompt_tokens, completion_tokens, total_tokens }.

curl https://gateway.guardion.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "x-guardion-policy: my-policy-slug" \
  -H "x-guardion-api-key: $GUARDION_API_KEY" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'
Response
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello! How can I help you today?" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}