DEV Community

TengLongAI2026
TengLongAI2026

Posted on

How I Gave Codex CLI Superpowers on Windows (with DeepSeek, No OpenAI Required)

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 last week, 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

┌──────────────┐    Responses API     ┌──────────────┐
│  Codex CLI   │────────────────────> │  codex-shim   │
│  (Terminal)  │<─────────────────── │  (Python)     │
└──────────────┘                     └──────┬───────┘
                                            │
                                            │
                                   ┌────────┴───────┐
                                   │  DeepSeek API   │
                                   └────────────────┘
Enter fullscreen mode Exit fullscreen mode

Three components:

  1. Codex CLI — OpenAI's terminal coding agent (87K★ on GitHub)
  2. codex-shim — A local Python/aiohttp server that translates OpenAI's Responses API to any upstream
  3. DeepSeek Chat — The model doing the actual reasoning

Step 1: Install Codex CLI

npm i -g @openai/codex
Enter fullscreen mode Exit fullscreen mode

That's it. 5 seconds on Windows. Check:

codex --version
# codex-cli 0.135.0
Enter fullscreen mode Exit fullscreen mode

Step 2: Install codex-shim

codex-shim isn't on PyPI, so I downloaded it from GitHub:

# Download the ZIP (71MB)
# Extract and install:
pip install ./codex-shim-0xSero/
Enter fullscreen mode Exit fullscreen mode

The shim requires Python 3.11+ and aiohttp. On Windows, it works natively in PowerShell or cmd.

Step 3: Configure the Model

Create ~/.codex-shim/models.json:

{
  "models": [
    {
      "model": "deepseek-chat",
      "provider": "openai",
      "base_url": "https://api.deepseek.com/v1",
      "api_key": "sk-your-deepseek-key-here",
      "display_name": "DeepSeek Chat"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

The shim supports multiple providers:

  • "openai" — any OpenAI-compatible endpoint (DeepSeek, Qwen, GLM, etc.)
  • "anthropic" — Anthropic Messages API format
  • "generic-chat-completion-api" — generic chat completion

Step 4: Start the Shim

# In a terminal window:
codex-shim --port 8765 start

# Verify:
curl http://127.0.0.1:8765/v1/models
# Returns: {"object":"list","data":[{"id":"deepseek-chat",...}]}
Enter fullscreen mode Exit fullscreen mode

Step 5: Configure Codex CLI

Save a profile config at ~/.codex/shim.config.toml:

model = "deepseek-chat"
model_provider = "codex_shim"
model_catalog_json = "path/to/custom_model_catalog.json"

[model_providers.codex_shim]
name = "Codex Shim"
base_url = "http://127.0.0.1:8765/v1"
wire_api = "responses"
experimental_bearer_token = "dummy"
Enter fullscreen mode Exit fullscreen mode

Step 6: Run It

# Interactive mode (recommended):
cd your-project
codex -p shim -s danger-full-access
Enter fullscreen mode Exit fullscreen mode

The -p shim flag loads the profile, -s danger-full-access gives Codex full filesystem access.

First Run

Here's what happened on my first test:

model: deepseek-chat
provider: codex_shim
--------
user: write a Python fibonacci script
codex: ✓ Listed directory
       ✓ Read file system
       ✓ Wrote Python script
       ✓ Executed and verified output
       ✓ 7,000+ tokens used, all routed through DeepSeek
Enter fullscreen mode Exit fullscreen mode

The "Anti-Slop" Advantage

Here's something interesting I discovered along the way.

While setting this up, I found two trending GitHub projects — taste-skill (28.5K★) and stop-slop (7.2K★) — that both tackle the same core problem: AI output quality.

  • taste-skill fixes AI-generated UI design (no more boring white+blue)
  • stop-slop fixes AI-generated prose (no more "delve into")
  • codex-shim fixes the model lock-in problem (no more forced OpenAI)

Together, they represent a shift: the AI community is demanding freedom AND quality.

What This Unlocks

With this setup, I can now:

  1. Use Codex CLI with any model — DeepSeek for daily tasks, Qwen for Chinese content, local Ollama for private code
  2. Switch models on the fly — different profiles for different tasks
  3. Bypass OpenAI's vendor lock — without losing Codex's excellent UX
  4. Save money — DeepSeek is significantly cheaper than GPT-4

Lessons Learned

  1. Don't accept vendor lock-in. If a tool only works with one model provider, there's probably a shim/proxy/plugin that fixes it.
  2. Local-first is powerful. The codex-shim runs entirely on localhost. No data leaves your machine unless you route it to an API.
  3. Windows is not an afterthought. Despite codex-shim's README focusing on macOS, the Python server runs perfectly on Windows.
  4. The Chinese AI ecosystem is real. DeepSeek, Qwen, GLM, Moonshot — these models are competitive and accessible. They just need a bridge to Western tools.

Try It Yourself

# 1. Install Codex CLI
npm i -g @openai/codex

# 2. Download and install codex-shim
# from https://github.com/0xSero/codex-shim
pip install ./codex-shim

# 3. Configure your model
# Edit ~/.codex-shim/models.json

# 4. Start the shim
codex-shim --port 8765 start

# 5. Run Codex
codex -p shim
Enter fullscreen mode Exit fullscreen mode

Resources:


From a setup where the model doesn't care where it runs. The future is multi-model. 🌏

Top comments (0)