Skip to content
NEWZhipu flagship GLM-5.4 is live: 1M context, native vision & all 3 protocolsView pricing
HopBase
← Back to blog

Run Claude Code, Codex CLI & Cursor in Hong Kong & Macau Without a VPN

Run Claude Code, Codex CLI & Cursor in Hong Kong & Macau Without a VPN

To run Claude Code, OpenAI Codex CLI, Cursor, and Gemini 4 in Hong Kong or Macau without a VPN, point each tool's base URL directly to https://api.hop-base.com (https://api.hop-base.com without /v1 for Anthropic and native Gemini protocols, and https://api.hop-base.com/v1 for OpenAI-compatible endpoints). Under official vendor region policies, direct API calls from Hong Kong and Macau ISPs (PCCW/HKT, HKBN, SmarTone, and CTM Macau) to api.anthropic.com, api.openai.com, and generativelanguage.googleapis.com fail with 403 Forbidden or unsupported_country_region_territory, while routing terminal coding agents through shared consumer VPN datacenter IPs frequently triggers sudden automated account suspensions and mid-session SSE stream drops. HopBase accepts direct, low-latency HTTPS connections from Hong Kong and Macau networks with no VPN or proxy, supports per-developer API keys with hard USD spend and concurrency caps, bills pay-as-you-go in USD via Visa/Mastercard, Apple Pay, Google Pay, AlipayHK, Alipay, or WeChat Pay, and returns exact per-request usage.cost_usd telemetry.

Why Official AI APIs Return 403 in Hong Kong & Macau—and Why VPNs Break Agent Workflows

Engineering teams across Hong Kong (Cyberport, HKSTP, Central) and Macau hit a familiar wall as soon as they move from browser chat to terminal coding agents or Bring-Your-Own-Key (BYOK) IDE workflows:

  • Official vendor region policies: Anthropic (api.anthropic.com), OpenAI (api.openai.com), and Google's Gemini API exclude both the Hong Kong SAR and the Macau SAR from their supported direct-access regions, and typically reject Hong Kong or Macau card billing addresses during developer onboarding. Direct requests from local residential, office fiber, or 5G networks fail immediately with HTTP 403 Forbidden or unsupported_country_region_territory.
  • VPN datacenter IP bans and stream instability: Unlike casual chat, autonomous coding agents such as Claude Code and Codex CLI fire dozens of rapid tool-use turns, count_tokens preflights, and long-lived Server-Sent Events (SSE) streams per task. Routing that traffic over shared commercial VPN exit nodes exposes datacenter ASNs and shifting geolocations that routinely trigger automated anti-abuse suspensions—freezing prepaid balances mid-sprint while adding extra tunnel hops that inflate time-to-first-token (TTFT) and drop long reasoning streams.

Pointing your tools at https://api.hop-base.com lets workstations and CI runners connect directly over local Hong Kong and Macau networks via standard TLS, with zero system proxies, TUN interfaces, or split-tunneling rules to maintain.

1. Claude Code Setup Without a VPN (~/.claude/settings.json)

Claude Code speaks the native Anthropic Messages API (POST /v1/messages). After creating an API key in the HopBase console that includes a Claude group (such as Claude Max Enterprise), you can either click One-Click Setup beside the key or write ~/.claude/settings.json directly:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.hop-base.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-hopbase-claude-key",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5"
  }
}

Key implementation details:

  • Do not append /v1 to ANTHROPIC_BASE_URL: Claude Code appends /v1/messages automatically. Setting https://api.hop-base.com/v1 sends requests to /v1/v1/messages and returns 404.
  • Switching models: Use claude-sonnet-5-5 for fast daily implementation, and switch to /model claude-opus-5-5 or /model claude-fable-5-2 inside a session (or launch with claude --model claude-opus-5-5) for deep architectural refactors.
  • Settings precedence: Values inside the env block of ~/.claude/settings.json override shell variables of the same name in ~/.zshrc. See the Claude Code integration docs for Windows PowerShell and CC Switch GUI multi-provider management.

2. OpenAI Codex CLI Setup Without a VPN (~/.codex/config.toml)

OpenAI's Codex CLI uses the OpenAI Responses API (POST /v1/responses). Create or edit ~/.codex/config.toml and define a custom hopbase model provider:

model_provider = "hopbase"
model = "gpt-6.2-sol"
model_reasoning_effort = "high"

[model_providers.hopbase]
name = "HopBase"
base_url = "https://api.hop-base.com/v1"
wire_api = "responses"
env_key = "OPENAI_API_KEY"

Then export a HopBase key that includes a Codex group (Codex Plus or Codex Pro) and launch codex:

export OPENAI_API_KEY="sk-your-hopbase-codex-key"
codex

Important: do not combine requires_openai_auth = true with env_key in manual configurations (requires_openai_auth = true is used only by the console's one-click installer alongside ~/.codex/auth.json). For heavy multi-file reasoning, switch model to "gpt-6.2-astra". Full details are in the Codex CLI guide.

3. Cursor Setup Without a VPN (Why Built-In Chat Works While BYOK Keys Fail)

Developers in Hong Kong and Macau often notice a puzzling split in Cursor: Cursor's built-in Pro subscription chat and Tab autocomplete work fine on local Wi-Fi, yet pasting a direct Anthropic or OpenAI API key under Cursor Settings → Models → API Keys (BYOK mode) triggers regional errors or verification failures. Built-in subscription requests are proxied through Cursor's own US backend, whereas custom BYOK keys require a reachable gateway endpoint that honours standard OpenAI and Anthropic wire protocols.

To configure Cursor with HopBase without a VPN:

  1. Open Cursor Settings → Models → API Keys.
  2. For GPT, Gemini, Qwen, or DeepSeek: Paste your HopBase key into the OpenAI API Key field, enable Override OpenAI Base URL, set it to https://api.hop-base.com/v1, and add model IDs such as gpt-6.2-sol, gpt-6.2-astra, gemini-4-neon, qwen4-max, or deepseek-v4.1-flash-1017.
  3. For Claude models: In recent Cursor releases, enter a Claude-group HopBase key in the Anthropic API Key section, override the Anthropic Base URL with https://api.hop-base.com (without /v1), and add claude-sonnet-5-5 or claude-opus-5-5. Using the native Anthropic transport preserves interleaved thinking across tool calls and prompt caching.

The exact same base URL rules apply to Cline, Roo Code, and Continue; see Editors and IDEs.

4. Antigravity CLI (agy) & Native Gemini 4 SDK Setup

Google's terminal agent Antigravity CLI (agy v1.1.13+) speaks the native Gemini v1beta endpoint directly. Two steps let it run on Hong Kong and Macau networks with no VPN:

First, switch ~/.gemini/antigravity-cli/settings.json to API-key mode so agy does not attempt region-restricted Google OAuth login:

{
  "modelProvider": "gemini"
}

Second, export a HopBase key that includes the Gemini group and set GOOGLE_GEMINI_BASE_URL to the root domain (no /v1beta suffix):

export GEMINI_API_KEY="sk-your-hopbase-gemini-key"
export GOOGLE_GEMINI_BASE_URL="https://api.hop-base.com"

agy --model gemini-4-carbon-high
# Or run a single non-interactive task
agy -p "Audit retry handling in internal/http and add table-driven tests" --model gemini-4-neon-medium

For application code using Google's official google-genai Python SDK, override base_url in http_options:

from google import genai

client = genai.Client(
    api_key="sk-your-hopbase-gemini-key",
    http_options={"base_url": "https://api.hop-base.com"},
)
resp = client.models.generate_content(
    model="gemini-4-carbon",
    contents="List three checklist items for zero-downtime PostgreSQL migrations.",
)
print(resp.text)

See the Antigravity CLI documentation for thinking-level suffixes (-low, -medium, -high).

5. Official List Price Reference Table for Coding Models (USD)

All prices below are official vendor list prices in USD from HopBase's public pricing snapshot (2026-12-04, USD per 1M tokens):

Model ID Recommended Protocol & Path Input / Output (per 1M tokens) Cached Input
claude-opus-5-5Anthropic Messages (https://api.hop-base.com)$4.00 / $20.00$0.20
claude-sonnet-5-5Anthropic Messages (https://api.hop-base.com)$2.00 / $10.00$0.10
claude-fable-5-2Anthropic Messages (https://api.hop-base.com)$8.00 / $40.00$0.20
gpt-6.2-solOpenAI Responses / Chat (/v1)$2.00 / $10.00$0.10
gpt-6.2-astraOpenAI Responses / Chat (/v1)$8.00 / $40.00$0.40
gemini-4-carbonNative Gemini (/v1beta) & OpenAI (/v1)$4.00 / $20.00$0.20
gemini-4-neonNative Gemini (/v1beta) & OpenAI (/v1)$3.00 / $15.00$0.15
qwen4-maxOpenAI Chat Completions (/v1)$1.47 / $4.41$0.074
deepseek-v4.1-flash-1017OpenAI Chat Completions (/v1)$0.29 / $1.18$0.0059

Note: above 272K context tokens, gpt-6.2-sol ($4.00 / $15.00) and gpt-6.2-astra ($16.00 / $60.00) follow OpenAI's official long-context multipliers. Live list prices are always published at hop-base.com/pricing, and your account's billing terms are shown in the signed-in console.

6. Team Keys, Per-Member USD Spend Caps & usage.cost_usd Verification

Standardizing your Hong Kong or Macau engineering team on one gateway eliminates shared API keys and surprise card declines:

  • Per-developer keys & hard USD budgets: Issue a distinct API key to each engineer, contractor, or CI workflow with its own USD spend cap and concurrency limit. Exhausting a key's cap immediately returns HTTP 402 insufficient_quota instead of draining the team balance, and revoking a departing contractor's key takes one click. Enterprise accounts add three-tier quotas across departments, members, and keys.
  • Local Hong Kong & Macau payment methods: Top up a pay-as-you-go USD balance with no monthly subscription and no credit expiry using Hong Kong, Macau, or international Visa / Mastercard cards, Apple Pay, Google Pay, AlipayHK, Alipay (mainland China), or WeChat Pay. Any payment processing fee is shown upfront on the Recharge page before you confirm.
  • Verify connectivity and exact usage.cost_usd with curl: Run these two commands from any Hong Kong or Macau terminal (with VPN turned off) to confirm direct reachability, inspect the exact USD deducted on non-streaming calls (usage.cost_usd and the X-HopBase-Cost-USD response header), and check remaining key quota:
# 1) Verify direct no-VPN response and exact per-call USD charge (usage.cost_usd)
curl -sS https://api.hop-base.com/v1/chat/completions   -H "Authorization: Bearer $HOPBASE_API_KEY"   -H "Content-Type: application/json"   -d '{"model":"gpt-6.2-sol","messages":[{"role":"user","content":"Reply only with OK"}]}' | jq '.usage'

# 2) Check remaining spendable USD balance for this API key
curl -sS https://api.hop-base.com/v1/usage   -H "Authorization: Bearer $HOPBASE_API_KEY" | jq .

For multi-modal workloads covering Kling 4.0, Seedance video generation, and finance CSV exports, see One API Key for Hong Kong & Macau Teams and the Account and catalog API reference.

FAQ

Do I need a VPN or proxy on PCCW, HKBN, SmarTone, or CTM Macau to run Claude Code and Codex CLI?

No. Official endpoints reject Hong Kong and Macau IPs due to vendor regional availability rules, whereas https://api.hop-base.com accepts direct HTTPS connections from all major Hong Kong and Macau broadband and mobile carriers without any VPN.

Why does setting ANTHROPIC_BASE_URL=https://api.hop-base.com/v1 return a 404 in Claude Code?

Claude Code's Anthropic client automatically appends /v1/messages to ANTHROPIC_BASE_URL, so adding /v1 produces /v1/v1/messages. Always use https://api.hop-base.com (no trailing /v1) for Claude Code and Antigravity CLI, and https://api.hop-base.com/v1 for Codex CLI and OpenAI-compatible SDKs.

Can Hong Kong and Macau teams pay with local credit cards or AlipayHK and cap spend per developer?

Yes. HopBase accepts Hong Kong and Macau Visa / Mastercard cards, Apple Pay, Google Pay, AlipayHK, Alipay, and WeChat Pay in USD with no US/EU billing-address requirement, lets you assign per-key and per-member USD spend caps, and exports line-by-line CSV usage logs for finance reconciliation.