How liuzhengming/ccswitch-deepseek works
ccswitch-deepseek is a local HTTP protocol proxy that lets Codex CLI use DeepSeek: it accepts Responses API requests, translates them to Chat Completions, forwards them upstream, and returns Responses-format output. The principal workflow also restores reasoning across turns and supports both streaming SSE and non-streaming replies. The README documents image/file/audio input handling and broader event coverage; source sampling confirms translation and streaming components, but not every documented behavior in detail.
Main entry points: index.js HTTP proxy · sse.js SSE translation · log.js Request logging · translate.js Request translation
Components 9
Proxy gateway
- HTTP proxy
index.js - Health endpoint
index.js - Request logging
lib/log.js
Protocol translation
- Request translation
lib/translate.js - SSE translation
lib/sse.js - JSON response mapping
index.js
Response state
- Reasoning recovery
lib/recover.js
Other components
- Codex CLI
- DeepSeek API
Connections 14
- Codex CLI → HTTP proxy: sends request
- Codex CLI → Health endpoint: checks status
- HTTP proxy → Request translation: translates input
- HTTP proxy → Reasoning recovery: restores reasoning
- HTTP proxy → DeepSeek API: posts completions
- DeepSeek API → HTTP proxy: returns completion
- HTTP proxy → SSE translation: feeds stream
- SSE translation → Codex CLI: emits SSE
- HTTP proxy → JSON response mapping: maps completion
- JSON response mapping → Codex CLI: returns JSON
- HTTP proxy → Reasoning recovery: stores reasoning
- HTTP proxy → Request logging: logs activity
- Request translation → Request logging: logs skips
- SSE translation → Request logging: logs events