API reference

Headers

Optional headers your app can send, and the governance headers on every response.

Request headers

HeaderPurpose
X-AIGov-UserThe end user inside your app, for attribution in audit logs and per-person reports. Use a stable ID or email.
X-AIGov-SensitivityComma-separated data classes the app knows are present: phi, pii, pci, confidential, public. Can raise the class, never lower it.

Response headers

HeaderValue
X-AIGov-DecisionWhat policy decided: allow, redirect, deny or held.
X-AIGov-RuleThe rule (or guardrail) that decided.
X-AIGov-ModelThe model that actually served the request.
X-AIGov-RiskRisk score of the request, 0 to 100.
X-AIGov-Cachehit or miss when the profile's response cache is on.
X-AIGov-Request-IdThe 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).

Python: reading the headers
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)