API reference
Headers
Optional headers your app can send, and the governance headers on every response.
Request headers
| Header | Purpose |
|---|---|
X-AIGov-User | The end user inside your app, for attribution in audit logs and per-person reports. Use a stable ID or email. |
X-AIGov-Sensitivity | Comma-separated data classes the app knows are present: phi, pii, pci, confidential, public. Can raise the class, never lower it. |
Response headers
| Header | Value |
|---|---|
X-AIGov-Decision | What policy decided: allow, redirect, deny or held. |
X-AIGov-Rule | The rule (or guardrail) that decided. |
X-AIGov-Model | The model that actually served the request. |
X-AIGov-Risk | Risk score of the request, 0 to 100. |
X-AIGov-Cache | hit or miss when the profile's response cache is on. |
X-AIGov-Request-Id | The ID to look the request up in Requests. |
Browsers can read the decision, rule, request ID, model and risk headers (they're exposed for CORS).
from openai import OpenAI
client = OpenAI(base_url="https://gateway.agentkeyroute.com/v1", api_key="<your API key>")
raw = client.chat.completions.with_raw_response.create(
model="gpt-4.1",
messages=[{"role": "user", "content": "Hello"}],
extra_headers={"X-AIGov-User": "alice@example.com"},
)
print(raw.headers["X-AIGov-Decision"], raw.headers["X-AIGov-Model"])
print(raw.parse().choices[0].message.content)