TL;DR: I installed Codex CLI on Windows, connected it to DeepSeek via a local shim server, and now I have a fully functional AI coding agent that doesn't need OpenAI at all. Here's exactly how I did it.
Why This Matters
I live in China. OpenAI's API is blocked here. For months, every time I tried to use an AI coding agent, I hit the same wall:
- Codex CLI connects to OpenAI's WebSocket -> blocked
- Claude Code needs an API key -> complicated
- Cursor is paid -> expensive
- GitHub Copilot -> limited model choice
But today, my boss shared a Toutiao article about codex-shim - a local Python server that intercepts Codex's API requests and routes them to any model you want.
I tried it. It worked. Here's the play-by-play.
The Architecture
Three components:
- Codex CLI - OpenAI's terminal coding agent (87K stars on GitHub)
- codex-shim - A local Python/aiohttp server that translates API calls
- DeepSeek Chat - The model doing the actual reasoning
Step 1: Install Codex CLI
npm i -g @openai/codex
5 seconds on Windows. Check: codex --version -> codex-cli 0.135.0
Step 2: Install codex-shim
pip install ./codex-shim-0xSero/
Requires Python 3.11+ and aiohttp. Works on Windows in PowerShell/cmd.
Step 3: Configure the Model
Create ~/.codex-shim/models.json with your DeepSeek API key and base URL.
Step 4: Start the Shim
codex-shim --port 8765 start
curl http://127.0.0.1:8765/v1/models
Step 5: Run Codex
codex -p shim -s danger-full-access
First Run
First test: I asked Codex to write a Fibonacci script in Python. It listed the directory, wrote the file, executed it, and verified output. 7,000+ tokens all routed through DeepSeek. No OpenAI needed.
Lessons Learned
- Don't accept vendor lock-in - there's always a shim
- Local-first is powerful - the shim runs on localhost
- Windows is not an afterthought - everything works
- The Chinese AI ecosystem is real - DeepSeek, Qwen, GLM are competitive
Resources
- Codex CLI: github.com/openai/codex (87K stars)
- codex-shim: github.com/0xSero/codex-shim (733 stars)
- DeepSeek: platform.deepseek.com
From a computer in Shenzhen, running AI agents that don't care where the model lives. The future is multi-model.
Top comments (0)