How to use Codex CLI in China? (OPENAI_BASE_URL proxy setup) #14893
Unanswered
holysheep123
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Codex CLI cannot connect to OpenAI API from China due to network restrictions:
Solution
Use an API relay service and set
OPENAI_BASE_URL:Option 1: One-command setup (recommended)
This automatically configures Codex CLI (and other tools like Claude Code, Aider, Gemini CLI) with the correct
OPENAI_BASE_URLand API key.Option 2: Manual configuration
Add to
~/.codex/config.toml:Or set environment variables:
How it works
HolySheep is an API relay that proxies requests to OpenAI/Anthropic/Google APIs from overseas servers. Pay-as-you-go, no subscription required.
Supported tools
The same relay works for:
Hope this helps other developers in China!
Beta Was this translation helpful? Give feedback.
All reactions