API reference
Endpoints & examples
Every endpoint goes through the same detection, policy, guardrails and audit.
| Method | Path | What it does |
|---|---|---|
| POST | /v1/chat/completions | Chat, tools and vision (OpenAI format). Streaming supported. |
| POST | /v1/responses | OpenAI Responses API. |
| POST | /v1/messages | Anthropic Messages API. Streaming supported. |
| POST | /v1/messages/count_tokens | Anthropic token counting. |
| POST | /v1/completions | Legacy text completions. |
| POST | /v1/embeddings | Vectors for search and RAG. |
| POST | /v1/rerank | Re-order documents by relevance to a query. |
| POST | /v1/images/generations | Image generation. |
| POST | /v1/audio/speech | Text to speech. |
| POST | /v1/videos | Start a video job; poll GET /v1/videos/{id}, download /content. |
| POST | /v1/moderations | Content moderation. |
| GET | /v1/models | Only the models this key may use. |
| POST | /v1/inspect | Check text before it goes to an AI website. No model is called. |
Not served (HTTP 501, not_governed)
Their content can't be inspected before it leaves your network:
/v1/audio/transcriptions, /v1/audio/translations, /v1/batches, /v1/files, /v1/images/edits, /v1/images/variations.Examples
Replace <your API key> with your key and the model names with ones your key may use.
Chat
curl https://gateway.agentkeyroute.com/v1/chat/completions \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-H "X-AIGov-User: alice@example.com" \
-d '{"model":"gpt-4.1","messages":[{"role":"user","content":"Hello"}]}'Streaming
curl -N https://gateway.agentkeyroute.com/v1/chat/completions \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4.1","stream":true,"messages":[{"role":"user","content":"Write a haiku"}]}'Tools
curl https://gateway.agentkeyroute.com/v1/chat/completions \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [{"role": "user", "content": "Weather in Paris?"}],
"tools": [{"type": "function", "function": {
"name": "get_weather",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
}}]
}'Responses
curl https://gateway.agentkeyroute.com/v1/responses \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4.1","input":"Hello"}'Messages
curl https://gateway.agentkeyroute.com/v1/messages \
-H "x-api-key: <your API key>" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet","max_tokens":512,"messages":[{"role":"user","content":"Hello"}]}'Embeddings
curl https://gateway.agentkeyroute.com/v1/embeddings \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"model":"text-embedding-3-small","input":["first passage","second passage"]}'Rerank
curl https://gateway.agentkeyroute.com/v1/rerank \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"model":"rerank-v3.5","query":"refund policy","documents":["Refunds within 30 days","Shipping takes 3 days"]}'Images
curl https://gateway.agentkeyroute.com/v1/images/generations \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-1","prompt":"A lighthouse at dusk","size":"1024x1024"}'Models
curl https://gateway.agentkeyroute.com/v1/models -H "Authorization: Bearer <your API key>"Inspect
curl https://gateway.agentkeyroute.com/v1/inspect \
-H "Authorization: Bearer <your API key>" \
-H "Content-Type: application/json" \
-d '{"destination":"chatgpt.com","user":"alice@example.com","text":"Summarise this note for John Smith"}'
# → {"action":"allow|redact|block","classes":[...],"findings":[...],"redacted":"...","reason":"...","request_id":"..."}