Connect
Send model calls through the gateway
One change of base URL, no code changes. The gateway forwards each call to your provider with your own key and records its model, tokens, exact cost, latency and tools.
The gateway is an OpenAI-compatible proxy at https://ai.odux.io/gateway/v1. It also speaks the OpenAI Responses
API (Codex) and the Anthropic Messages API (Claude Code), so it works with the OpenAI and Anthropic SDKs, LangChain,
Cline, Roo Code, n8n and most tools with an "OpenAI-compatible" setting.
#What it records, and what it does not
| Recorded for every call | Never stored |
|---|---|
| model and provider, input tokens (cached and uncached) and output tokens, cost, latency, the names of the tools offered and called, the agent, whether the call was stopped | the prompt, the answer, files, tool arguments and results |
The one exception is content mode, which is off unless your workspace's admin turns it on.
Important. The gateway is in the live path: if IA4AI is unreachable, your calls fail with an error instead of reaching your provider. You can take it out of the path in about 30 seconds. Read If IA4AI is down first, and use OpenTelemetry if nothing may sit between you and your provider.
#Set it up
#1. Add your provider key
On your Connect page (Setup → Open the setup guide), under Your agents and apps, pick the provider and paste
its API key, then click Test and save. IA4AI checks the key against the provider's /models endpoint (no tokens
spent) before saving it.
The models you list for a key are enforced: a request for any other model is refused, even on the same provider.
Leave the list empty to allow every model that provider serves, or use a prefix such as deepseek- for a family.
Entries are tried in order, so a narrow entry can sit in front of a wider one.
Note. Paste the provider's key here, not your IA4AI key and not a URL. A value that looks like a URL is refused with a message that says so.
#2. Point your agent at the gateway
Set the base URL and use your IA4AI key as the API key:
OPENAI_BASE_URL=https://ai.odux.io/gateway/v1
OPENAI_API_KEY=YOUR_IA_KEYIf your tool asks for a header instead, send x-api-key: YOUR_IA_KEY or Authorization: Bearer YOUR_IA_KEY. Both
work.
#3. Check it
curl -s https://ai.odux.io/gateway/v1/whoami -H "Authorization: Bearer YOUR_IA_KEY"Connected as … lists your workspace, the provider keys you stored and the agent name the gateway sees. Not attributed means the request carried a provider key instead of your IA4AI key: it still works, but it is filed under no workspace and reaches no dashboard.
Every gateway response says the same in its headers: x-ia-attribution: client with x-ia-workspace, or
x-ia-attribution: unattributed.
#Using your own provider key in the request
If you would rather not store a provider key, send both: your IA4AI key in x-api-key, and your provider key as the
bearer token. The provider key is forwarded and not kept, and the call is filed under your workspace. When a stored
key exists for that provider, the stored one is used.
#Name each agent
Without a name, the gateway uses what the tool says about itself: Cline, Roo Code, Claude Code, n8n and the OpenAI SDKs are recognised; anything else shows as unidentified. To name one yourself, either add a header:
x-ia-agent: support-botor put the name in the base URL:
https://ai.odux.io/gateway/agent/support-bot/v1The name is a label for your dashboard, not a credential: your key still decides whose traffic it is. Every response
carries the name back in x-ia-agent.
#Which provider a model goes to
The gateway picks the provider from the model name's prefix, for example deepseek- → DeepSeek, kimi- and
moonshot- → Moonshot, gpt-, o1, o3, o4 → OpenAI, claude- → Anthropic. To see exactly what your key can
call:
curl -s https://ai.odux.io/gateway/v1/models -H "Authorization: Bearer YOUR_IA_KEY"The list is narrowed to the models your stored keys allow, so a model picker built from it never offers a model the gateway would refuse.
#Streaming
Streamed responses work as usual. Token counts arrive in the final chunk, so send
"stream_options": {"include_usage": true} on Chat Completions streams: without it the gateway still records the
call, its latency and tools, but the tokens and the cost read zero. A stream cut off before its usage arrives is
estimated and labelled as estimated.
#Errors you may see
| Status | Usually means |
|---|---|
401 |
No credential was sent, or the IA4AI key is unknown (mistyped, or replaced). |
400 with a message |
No stored provider key covers that model (none for that provider, or the model is outside the key's list), or the provider does not take that API format. The message says which. "Locked with your previous IA key" means you replaced your key and that provider key must be added again. |
429 |
Too many requests. The body says so; retry shortly. A 429 from your provider is passed through as it came. |
502 |
The provider could not be reached for that model name. Check the name against the prefixes above. |
| An authentication error from the provider | The two keys are swapped: your IA4AI key goes to the gateway, your provider key into your Connect page. |
#Routing recommendations
The gateway can say when a call looks like one a smaller model could handle: in its recommend mode it adds
x-ia-recommended-model and x-ia-route-band to the response and forwards the call exactly as you sent it. See
Gateway endpoints and headers.

