Start here
Sign in once with the oh CLI, then start your client through it.
The quick way: the oh CLI
Install the oh CLI, then:
oh ai-gateway login --gateway-url https://ai-gateway-<id>.dp.onehouse.ai # once
oh ai-gateway run -- claude # every session
oh ai-gateway run -- codex -m <alias>
run starts a small local proxy, points the client at it, and stops it when the client exits. The proxy adds a fresh gateway token to every request and retries once after a 401, so a token never goes stale mid-session. Nothing is copied by hand or written to disk.
login also prints a one-time MCP entry for Claude Code and Codex, so the gateway's tools work too. The client pages below explain it.
| Client | How |
|---|---|
| Claude Code | oh ai-gateway run -- claude |
| Codex | oh ai-gateway run -- codex -m <alias> |
Another client that reads ANTHROPIC_BASE_URL | oh ai-gateway proxy runs the proxy on its own and prints the two variables to set. |
| A script | oh ai-gateway token prints a current token. |
| VS Code and JetBrains | A token from the token page. |
See oh ai-gateway for every command.
Or paste a token
Anything that speaks the OpenAI or Anthropic API can also call the gateway directly, with a token from the gateway's token page. See Sign-in and tokens. The token page has a tab for each client with your token and address already filled in.
- base_url = "https://api.openai.com/v1"
+ base_url = "https://ai-gateway-<id>.dp.onehouse.ai/v1"
A pasted token does not renew. When it expires, sign in again and restart the client.
The token header
The gateway reads your token from its own header, and only from there:
X-Onehouse-Authorization: Bearer <token>
A token sent as Authorization: Bearer <token> instead is refused with 401 before it reaches the gateway.
If a request carries X-Onehouse-Authorization, any Authorization or x-api-key header beside it is read as your own provider key and passed upstream. Your gateway token is then not what reaches the provider, and the call bills to that key.
Check it works
export ONEHOUSE_GATEWAY_TOKEN="<token>" # from the token page
curl https://ai-gateway-<id>.dp.onehouse.ai/v1/models \
-H "X-Onehouse-Authorization: Bearer $ONEHOUSE_GATEWAY_TOKEN"
With the oh CLI, oh ai-gateway token prints the whole header instead: curl -H "$(oh ai-gateway token | head -1)" ….
This lists the model names you can call. An empty list means you hold Invoke on none of them yet. Ask a project admin.
Then make a call
curl https://ai-gateway-<id>.dp.onehouse.ai/v1/chat/completions \
-H "X-Onehouse-Authorization: Bearer $ONEHOUSE_GATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "<alias>",
"messages": [{"role": "user", "content": "Say hello."}]
}'
The gateway serves /v1/chat/completions, /v1/completions and /v1/responses (OpenAI), and /v1/messages and /v1/messages/count_tokens (Anthropic).
If a call is refused, the answer names why. See Troubleshooting.
The gateway endpoint is not reachable from the public internet. From a laptop, connect through your VPN or bastion first — see Connect to your VPC.