Claude Code

Add opengateway as a Claude Code option with a claude-opengateway alias — Anthropic-compatible /v1/messages, your existing default setup stays untouched.

Copy this to your agent
Paste it into any AI agent. It sets up the claude-opengateway alias and saves it as the opengateway-claude-code skill.

Run it once, nothing saved#

Not ready for either? Copy the command instead — nothing is written to your shell profile or ~/.claude/settings.json, and the next plain claude run is exactly as before:

ANTHROPIC_BASE_URL="https://apis.opengateway.ai" \
ANTHROPIC_AUTH_TOKEN="YOUR_OPENGATEWAY_API_KEY" \
ANTHROPIC_MODEL="z-ai/glm-5.2-ultrafast" \
ANTHROPIC_SMALL_FAST_MODEL="z-ai/glm-5.2-ultrafast" \
claude

Set it up by hand#

1. Get an API key#

opengateway.aiAPI KeysCreate Key. It is only displayed once.

2. Add the launcher#

Append to ~/.zshrc or ~/.bashrc:

alias claude-opengateway='ANTHROPIC_BASE_URL="https://apis.opengateway.ai" ANTHROPIC_AUTH_TOKEN="YOUR_OPENGATEWAY_API_KEY" ANTHROPIC_MODEL="z-ai/glm-5.2-ultrafast" ANTHROPIC_SMALL_FAST_MODEL="z-ai/glm-5.2-ultrafast" claude' # opengateway-claude-code

The trailing # opengateway-claude-code tag marks the line as ours — undoing the setup is deleting the tagged line, nothing else changes.

The base URL is the host root — no /v1 suffix; Claude Code appends /v1/messages itself. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. /v1/messages currently serves one model: z-ai/glm-5.2-ultrafast — the rest of the catalog lives on Chat Completions.

3. Run the launcher#

source ~/.zshrc # or open a new terminal
claude-opengateway

claude-opengateway starts an opengateway-backed session; plain claude keeps your existing setup. To make opengateway the default instead, put the same variables in the env block of ~/.claude/settings.json.

4. Verify#

claude-opengateway --print "Reply with OK"

A response means it works — the call is already on the dashboard with tokens, cost, and latency.