curl (Generic HTTP)
Any AI runtime that speaks HTTP can call an LLM Registry endpoint — this page shows the raw curl calls for each provider so you can adapt them to your own scripts, integrations, or one-off tests.
The gateway accepts each provider's native wire shape. The path suffix and body stay the same as if you were calling the provider directly; only the host name and the auth headers change:
- The Agent Access Key authenticates the caller to the gateway. It rides on
X-Agent-Key(or, for clients that only expose one auth slot, onAuthorization: Bearerorx-goog-api-key). - When the entry runs in passthrough mode, the provider credential travels alongside — the gateway forwards it to the provider unchanged.
Setup
Pick your provider and mode.
- OpenAI
- OpenRouter
- Anthropic
- Gemini
- Bedrock
- Direct — gateway-managed key
- Passthrough
The gateway stores the OpenAI credential on the entry, so the caller sends only its Agent Access Key.
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-d '{"model":"<model-id>","messages":[{"role":"user","content":"Hello"}]}'
The model in the body must be one the entry's Allowed Models list permits (unless the entry allows all models).
The gateway holds no OpenAI credential on this entry. The caller sends both an Agent Access Key (to the gateway) and its own OpenAI key (which the gateway forwards to OpenAI).
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-H "Authorization: Bearer <your-openai-api-key>" \
-d '{"model":"<model-id>","messages":[{"role":"user","content":"Hello"}]}'
OpenRouter accepts model IDs in vendor-scoped form (openai/gpt-5.1, anthropic/claude-sonnet-4.6, google/gemini-2.5-flash-lite, moonshotai/kimi-k2.5) as well as OpenRouter's own routing shorthands (~moonshotai/kimi-latest).
- Direct — gateway-managed key
- Passthrough
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-d '{"model":"<vendor>/<model>","messages":[{"role":"user","content":"Hello"}]}'
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-H "Authorization: Bearer <your-openrouter-api-key>" \
-d '{"model":"<vendor>/<model>","messages":[{"role":"user","content":"Hello"}]}'
Anthropic's Messages API requires the anthropic-version header on every call.
- Direct — gateway-managed key
- Passthrough
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/messages" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-H "X-Agent-Key: <your-agent-access-key>" \
-d '{"model":"<model-id>","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'
Anthropic's SDK convention is to send the provider credential on the x-api-key header (not Authorization: Bearer).
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1/messages" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-H "X-Agent-Key: <your-agent-access-key>" \
-H "x-api-key: <your-anthropic-api-key>" \
-d '{"model":"<model-id>","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'
Gemini is served through Google's OpenAI-compatible endpoint by default — same body shape as OpenAI Chat Completions.
- Direct — gateway-managed key
- Passthrough
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1beta/models/<model-id>:generateContent" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-d '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}]}'
curl -X POST "https://<gateway-host>/llm/<url-prefix>/v1beta/models/<model-id>:generateContent" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-H "x-goog-api-key: <your-google-api-key>" \
-d '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}]}'
Bedrock addresses the model in the URL path, not the body, and speaks the Converse API shape.
Newer Claude and Nova models require the cross-region inference profile prefix — e.g., global.anthropic.claude-sonnet-4-6 or us.anthropic.claude-haiku-4-5-20251001-v1:0. A bare anthropic.claude-sonnet-5 returns "on-demand throughput isn't supported" from AWS.
- Direct — gateway-managed key
- Passthrough
The gateway signs the outbound call with the AWS credentials stored on the entry, so no AWS keys travel from the client.
curl -X POST "https://<gateway-host>/llm/<url-prefix>/model/<inference-profile-id>/converse" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-d '{"messages":[{"role":"user","content":[{"text":"Hello"}]}]}'
The gateway forwards the caller's Bedrock API key on Authorization: Bearer — no SigV4 signing on either side.
curl -X POST "https://<gateway-host>/llm/<url-prefix>/model/<inference-profile-id>/converse" \
-H "Content-Type: application/json" \
-H "X-Agent-Key: <your-agent-access-key>" \
-H "Authorization: Bearer <your-bedrock-api-key>" \
-d '{"messages":[{"role":"user","content":[{"text":"Hello"}]}]}'
Where to find each value
| Placeholder | Where to find it |
|---|---|
<gateway-host> | Host from the LLM Registry entry's Overview tab (e.g., gw.aigateway.example.com) |
<url-prefix> | The URL prefix field on the entry's Overview tab |
<model-id> | The provider's model identifier, from the entry's Allowed Models list |
<inference-profile-id> | Bedrock inference-profile ID (e.g., global.anthropic.claude-sonnet-4-6) |
<vendor>/<model> | OpenRouter model in vendor-scoped form (e.g., openai/gpt-5.1) |
<your-agent-access-key> | Generate from the LLM Registry entry's Agent Access Keys step; plaintext is shown once |
<your-*-api-key> | Your provider's own API key — only needed in passthrough mode |
Tips
- Anthropic-version header is mandatory. Anthropic 400s any call to
/v1/messagesthat omitsanthropic-version, whether or not the provider credential is stored by the gateway. - Streaming is transparent. Add
"stream": trueto the body (or?alt=ssefor Gemini's native path); the gateway forwards the stream unchanged.
Cequence AI Gateway