The short answer: you can run Claude Code through HopBase without a VPN or any code changes by setting two environment variables. Register, create an API key on the console's "API Keys" page, then export ANTHROPIC_BASE_URL=https://api.hop-base.com and ANTHROPIC_AUTH_TOKEN set to your key, and run claude; add both lines to ~/.zshrc or ~/.bashrc to make them permanent. The gateway keeps cross-border jitter and provider-side rate limiting out of your workflow with redundant routing, automatic failover and transparent per-request billing. A key can only call models in the groups it includes, so pick a group with redundant routing for daily development and production, a latency-first group for interactive work, or a lower-priced group for batch jobs. If something fails, open a new terminal so the variables load, confirm the key's groups include your model, and test outside any corporate HTTPS proxy. Every request appears in the console's usage page with tokens, cache hits and cost.
Claude Code is Anthropic's AI coding tool, but direct connections to the official API from certain regions can be flaky: timeouts during peak hours, connections dropping mid-request, accounts mysteriously getting rate-limited. This article provides a stable setup path — no VPN tricks, no code changes, just two environment variables to get connected.
Why You Need a Gateway
The biggest issue with direct connections isn't "can't connect" — it's unpredictability. You can't control the jitter on cross-border routes, you can't predict rate limiting on the model provider's side, and what developers fear most is exactly that: "it was working fine five minutes ago." A gateway's job is to keep that uncertainty out of your workflow: redundant routing, automatic failover, transparent per-request billing.
A gateway's value isn't in forwarding requests — it's in shielding your workflow from uncertainty you can't control.
Three-Step Setup
First, register and log into the console, then create a new API Key in the "API Keys" page. Second, set two environment variables in your terminal:
# Two environment variables — Claude Code connects to the gateway
export ANTHROPIC_BASE_URL=https://api.hop-base.com
export ANTHROPIC_AUTH_TOKEN=your-key-here
claude # Use normally — usage shows up in the console in real timeThird, run claude and start a conversation. If autocompletion works normally, you're done. To make it permanent, add these two lines to ~/.zshrc or ~/.bashrc.
Three Common Pitfalls
- Environment variables not taking effect: After editing your shell config, open a new terminal or run
source; terminals launched from your IDE might not read your shell config. - Key permissions don't match: A key can only call the models in the groups it includes (one key can include several groups). If you get a "model not available" error, check in the console that one of the key's groups includes the model you need — or add that group to the key.
- Corporate proxy interference: Enterprise HTTPS proxies sometimes rewrite request headers. If you see weird 401/403 errors, test in an environment without a proxy first.
Choose Your Group by Use Case
One key can use every model in the groups it includes. Different groups have different pricing and routing strategies (the table shows typical group types; actual group names in the console vary):
| Group type | Best for | Highlights |
|---|---|---|
| Stable tier | Daily development, production | Redundant routing, automatic failover |
| Fast tier | Interactive, heavy conversation | First-token latency priority |
| Economy tier | Batch jobs, offline processing | Lowest per-token price |
Verification and Transparent Billing
After one request, the usage page in your console shows a record immediately — model, token count, cache hits, and cost all aligned. Tokens that hit prompt cache are billed at a steep discount; conversational tools like Claude Code usually see a substantial share of cache hits, so your actual cost often comes in lower than you'd estimate from list prices.