Skip to content
English

Gateways

Register an endpoint, a key, and a model catalog, then bind any client to it.

Updated View as Markdown

A gateway is an API profile: an endpoint, a credential, and optionally a list of models. There is no login flow and no local process — the client talks to the remote endpoint directly.

Add one

anypick add gateway openrouter-work \
  --provider openrouter \
  --endpoint https://openrouter.ai/api/v1 \
  --api-key "$OPENROUTER_API_KEY" \
  --model anthropic/claude-sonnet-4 \
  --models default=anthropic/claude-sonnet-4 \
  --models opus=anthropic/claude-opus-4-8

anypick use claude --with openrouter-work
anypick run claude
Flag Meaning
--provider <id> Which catalog shape the endpoint follows
--endpoint <url> Base URL
--api-key <key> Key stored in the AnyPick database
--api-key-env <var> Read the key from an environment variable at activation instead of storing it
--model <id> Default model for this gateway
--models <role=id> Pin one client model role (default, sonnet, opus, haiku, …) to a gateway model; repeat the flag for more roles
--gateway-id <id> Gateway id for providers addressing several gateways per endpoint

--models is a role map, not a free list of ids: the stored value is written into each client’s own role slots, so a bare id has no role to attach to and the flag is refused. Pass role=model-id, once per role.

Catalog providers include anthropic, openai, openrouter, grok-api, gemini-api, litellm, local, custom and cloudflare-aigateway — the full set is Builtin() in src/go/internal/catalog/catalog.go.

Cloudflare AI Gateway needs an explicit endpoint (the base URL embeds the Cloudflare account id) and a gateway id:

anypick add gateway cf-prod \
  --provider cloudflare-aigateway \
  --endpoint https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/v1 \
  --api-key "$CF_API_TOKEN" \
  --gateway-id my-gateway

Omit --gateway-id to use the provider default (default).

Gateway or proxy?

Both are sources, and both end the same way — use <client> --with <source>. They differ in what stands behind them.

Proxy (account) Gateway (API profile)
Auth Native login snapshot, plus a local process Endpoint + key held by AnyPick
Setup Log in with the provider CLI, then snapshot Paste an endpoint and a key
Models Discovered from the running proxy Gateway defaults, or per binding
Where requests go 127.0.0.1:<port> → upstream Straight to the endpoint

Reach for a gateway when you hold a key. Reach for an account when you hold a subscription.

Models in the client’s picker

For clients with a native model registry — Codex, OpenCode, ZCode, Command Code, and DSH — AnyPick writes the source-scoped catalog so the ids available in the client match the selected gateway or proxy. Set the default with --model; it becomes the model the client starts on.

Claude Code, Gemini CLI, and Kiro expose model selection through environment variables or native role slots rather than a writable model registry. AnyPick configures their native default/role values, but cannot invent a client-side list those programs do not read.

Account proxies do not need this — AnyPick reads their live /v1/models catalog whenever it activates the client.

Managing gateways

anypick gateway list
anypick gateway show openrouter-work
anypick gateway edit openrouter-work -m anthropic/claude-sonnet-4
anypick gateway edit openrouter-work --endpoint https://…  --api-key "$NEW_KEY"
anypick gateway remove old-gateway -y

show masks the key. Pass the global --reveal flag to print it, which is exactly as dangerous as it sounds.

Bindings are snapshots, so editing a gateway does not retroactively change a client that is already bound to it. Re-run use to pick up the new endpoint or model.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close