English Β· PortuguΓͺs Β· EspaΓ±ol
High-performance OpenAI- and Anthropic-compatible API gateway that bridges modern AI coding agents and clients (Claude Code CLI, OpenAI Codex, OpenCode, Cursor, OMP, Zed, Grok) to Qwen (chat.qwen.ai) with multi-account rotation, intelligent failover, robust tool calling, thread-native delta execution, image & video generation, full OpenAI Responses API with persistent memory, and durable sessions. Powered by stealth headless Chromium, transient retry ladders, public base/-fast/-thinking variants, compressed caching, dynamic model capability registry, and full observability.
If QwenProxy is helping you or your team and you would like to support continuous maintenance, new client integrations, live probes, and rapid upstream patches, consider voluntary sponsorship:
Every contribution helps cover infrastructure costs, proxy bandwidth, and test accounts!
- Native OpenAI & Anthropic Compatibility β
/v1/chat/completions,/v1/models,/v1/messages(native Anthropic Messages API for Claude Code CLI and official@anthropic-ai/sdk),/v1/messages/count_tokens, OpenAI Responses API (/v1/responses), and/v1/completions(legacy adapter). - Full 4-Mode Conversation Matrix β
thread(default persistent),thread-temp(delta ~1KB ephemeral, recommended for coding agents),stateless-temp(OpenAI official stateless standard, ephemeral), andstateless(OpenAI official stateless standard, saved to web account). - Real-Time Dynamic Mode Switching β Switch the global proxy API mode instantly via TUI (
Mon the status screen orF4in Chat) or via/v1/chat/modeHTTP endpoint, without restarting the server. - Full Terminal Dashboard TUI (
qpx) β Interactive monospace UI with full mouse support (hover, click, drag, and scroll), vertical model/mode selectors, and nativeQwenProxyterminal window title. - Batch Account Import (
B) β Paste dozens of accounts in seconds (email:password,.envformat, tab, pipe). Stored with at-rest encryption in a single SQLite transaction (<10ms) with deduplication and live count badges. - Dynamic Viewport Scrolling β Smooth list navigation across 50+ accounts without layout overflow or column misalignment.
- 1-Click Coding Agent Sync (
qpx sync) β Automated setup for Claude Code, OpenAI Codex, OpenCode, Cline, OMP, Zed, Kilo Code, and Hermes with 1-click backup rollback. - Ultra-Light Single Chromium Instance β 1 shared browser process with hardware WebGL acceleration and isolated
BrowserContextstorage states (~200MB RAM across all accounts, >65% resource reduction). - On-Demand Warmup & Multi-Account Pool β Boots instantly with the primary account ready; standby accounts remain idle and warm up lazily on demand (during failover or rotation).
- Clean Personalization Synchronization β System prompts and tools ride account personalization (
/settings/personalization), mirroring the official web client and avoiding WAF bot triggers. - Self-Healing Tool Call Parser β Handles fragmented streams, broken JSON parameters, unified
<qpx_call>tags, fuzzy name matching (readFileβread_file), and intelligent auto-retry ladders. - Image & Video Generation β Dedicated
/v1/images/generationsand/v1/videos/generationsendpoints with flagship models (qwen-image-3.0-pro,wan3.0-video,wan2.7-image-pro). - Observability & Health Monitoring β Real-time metrics at
/health,/metrics(Prometheus), RSS watchdog, and unified clean log pairs per turn.
flowchart TD
Client["Client: Claude Code / Codex / OpenCode / Cursor / OMP"] -->|HTTP / SSE| Proxy["QwenProxy - Hono"]
Proxy --> Chat["/v1/chat/completions"]
Proxy --> Anthropic["/v1/messages"]
Proxy --> Completions["/v1/completions (legacy)"]
Proxy --> Responses["/v1/responses"]
Proxy --> Media["/v1/images | /v1/videos"]
Proxy --> Models["/v1/models"]
Proxy --> Upload["/v1/upload"]
Anthropic --> Chat
Completions --> Chat
Responses --> Chat
Responses --> Effort["Effort normalization"]
Responses --> State[("SQLite responses_store")]
Chat --> Context["Thread-native context"]
Chat --> Accounts["Account manager"]
Accounts --> DB[("SQLite encrypted")]
Accounts --> Playwright["Playwright + Stealth"]
Playwright --> Fingerprint["Fingerprint / session keeper"]
Chat --> Parser["Tool-call parser"]
Chat --> Personalization["Settings + personalization sync"]
Chat --> BrowserTransport["Playwright page fetch + SSE bridge"]
BrowserTransport --> Qwen["chat.qwen.ai"]
Media --> BrowserTransport
Upload --> OSS["Qwen OSS"]
QwenProxy provides a complete matrix of 4 conversation modes, letting you choose the exact balance between token efficiency, latency, and history organization:
| Mode | Payload Strategy | Upstream Qwen Mode | Saved to Web Account? | Recommended Use Case |
|---|---|---|---|---|
thread-temp β |
Delta (~1KB) | chat_mode: "local" |
β No (Zero pollution) | The best mode for daily development. Recommended for Claude Code, Codex, OpenCode, and Cursor. Maximum speed, ultra-low TTFB, and zero sidebar clutter on chat.qwen.ai. |
stateless-temp |
Full History | chat_mode: "local" |
β No (Zero pollution) | Official API Standard (OpenAI/Anthropic). Resends full message history on every turn. Ideal if your client edits, prunes, or re-orders past turns mid-session. |
thread (Default) |
Delta (~1KB) | chat_mode: "normal" |
β Yes (Saved to web) | Perfect if you want to inspect or continue your agent's conversation later directly inside the official chat.qwen.ai mobile app or desktop browser. |
stateless |
Full History | chat_mode: "normal" |
β Yes (Saved to web) | Resends full message history on every turn while persisting every chat session into your Qwen account history. |
- Via Interactive TUI (Real-Time Global Switch):
- On
[1] Statusscreen: PressM(or click[ M ] Alternar Modo) to cycle the global API mode instantly. - On
[2] Chatscreen: PressF4(or click the[ Modo ]header button) to open the vertical modal selector.
- On
- Via Remote HTTP Endpoint:
# Inspect active mode: curl http://127.0.0.1:7936/v1/chat/mode # Update mode globally in real time: curl -X POST http://127.0.0.1:7936/v1/chat/mode \ -H "Content-Type: application/json" \ -d '{"mode":"thread-temp"}'
- Per-Request Header Override:
Send
X-QwenProxy-Chat-Mode: thread-temp(orstateless-temp,thread,stateless) in individual HTTP requests. - Via
.envConfiguration (Boot Default):QWEN_CHAT_MODE=thread
Install the QwenProxy CLI globally on your workstation:
# Via npm:
npm install -g qwenproxy-cli
# Or via pnpm / bun:
pnpm add -g qwenproxy-cli
# bun add -g qwenproxy-cliOpen your terminal and run:
qpxQwenProxy launches the high-performance proxy server in the background and opens the interactive dashboard. The terminal window title will automatically update to QwenProxy.
π Where to create accounts?
Create your free accounts directly on the official Qwen Web portal: https://chat.qwen.ai
- Go to chat.qwen.ai and click Sign up.
- Register with your email and password (or Google login).
- Pro Tip: Create 3 to 10 accounts so QwenProxy can automatically rotate between them when daily quotas are reached, giving you continuous uninterrupted coding!
Inside the TUI, navigate to tab [5] Accounts to manage credentials:
- Batch Import (
B): PressB(or click[ B ] Em Lote). Paste your account credentials in bulk (email:passwordper line, raw.envstring with commas, or spreadsheet paste). The parser calculates valid accounts in real time, handles special password characters safely, skips duplicates, and commits encrypted credentials to SQLite in a single transaction (<10ms). - Single Account (
A): PressAto manually type email and password. - Browser Login: If you prefer visual login with manual captcha solving:
qpx login.
To automatically configure your installed coding agents to route through QwenProxy:
# Automatically sync all detected agents:
qpx sync
# Or target specific agents:
qpx sync claude codex opencodeThe synchronizer configures:
- Claude Code CLI (
~/.claude/settings.json) β Native Anthropic protocol (/v1/messages). - OpenAI Codex CLI (
~/.codex/config.toml) β Native Responses protocol (/v1/responses). - OpenCode (
~/.config/opencode/opencode.jsonc) β OpenAI-compatible provider. - Cline, OMP, Zed, Kilo Code, and Hermes Agent.
Rollback tip: Restore previous client configuration backups anytime with
qpx sync --restore(ornpm run sync:restore).
Launch your favorite coding tool as you normally would:
# Run Claude Code:
claude
# Run Codex CLI:
codex
# Run OpenCode:
opencodeAll completions and tool calls will flow through your local QwenProxy gateway with zero external API fees, high context windows, and automatic multi-account rotation!
- Use
thread-tempfor Agentic Coding Work:
Coding agents generate dozens of turns and tool calls per minute. Running inthread-tempkeeps your Qwen account clean while delivering blazing-fast ~0.6sβ1.2s TTFB. - Multi-Account Quota Reset (00:00 UTC):
Configure 2 or more accounts. Qwen Web daily quotas reset strictly at 00:00 UTC. When an account reaches its limit, the proxy parks it until midnight and seamlessly promotes the next healthy standby account. - Profile Disk Pruning (
qpx clean):
Over time, Chromium contexts accumulate transient V8 and GPU caches. Runqpx cleanto shrink profiles from ~300MB down to ~4.5MB per account, while preserving cookies and authenticated sessions intact. - Instant Cooldown Reset:
To immediately unpark accounts on cooldown, pressZon the[1] Statusscreen or runqpx reset.
Models and context windows are synchronized dynamically from Qwen's live /api/models catalog per account. Capabilities and metadata are resolved automatically:
| Model | Context Window | Max Output | Thinking | Vision |
|---|---|---|---|---|
qwen3.8-max |
1,000,000 | 131,072 | β Yes | β Yes |
qwen3.7-plus |
1,000,000 | 65,536 | β Yes | β Yes |
qwen3.7-max |
1,000,000 | 65,536 | β Yes | β No |
| Fallback | 1,048,576 | 65,536 | β | β |
- Base Model β Auto mode (Qwen decides whether to reason), e.g.:
qwen3.8-max -fastβ Thinking disabled for rapid generation, e.g.:qwen3.8-max-fast-thinkingβ Thinking forced ON, e.g.:qwen3.8-max-thinking
Standard OpenAI reasoning_effort values (low, medium, high) are supported:
low/noneβ forces Fast mode (thinking OFF).medium/high/maxβ enables thinking.
| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions |
POST | Chat completions (streaming & non-streaming) |
/v1/chat/completions/stop |
POST | Abort an active generation |
/v1/chat/mode |
GET / POST | Inspect or update the global conversation mode in real time |
/v1/models |
GET | List available models and capabilities |
/v1/models/:id |
GET | Model details |
/v1/responses |
POST | Full OpenAI Responses API with persistent memory |
/v1/responses/:id |
GET / DELETE | Retrieve or delete stored response context |
/v1/completions |
POST | Legacy completions adapter |
| Endpoint | Method | Description |
|---|---|---|
/v1/messages |
POST | Native Anthropic Messages API (Claude Code CLI, SDK) |
/v1/messages/count_tokens |
POST | Token counting endpoint |
| Endpoint | Method | Description |
|---|---|---|
/v1/images/generations |
POST | Image generation (qwen-image-3.0-pro, wan2.7-image-pro) |
/v1/videos/generations |
POST | Video generation (wan3.0-video up to 1080P, wan2.7-t2v) |
/v1/tasks/status/:taskId |
GET | Check asynchronous video task progress |
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | System health check and active stream metrics |
/metrics |
GET | Prometheus exposition |
/v1/upload |
POST | Multimodal asset upload |
| Command | Description |
|---|---|
qpx (or npm run tui) |
Open interactive TUI dashboard with integrated server |
qpx start (or npm start) |
Start headless proxy server (no UI) |
qpx sync (or npm run sync) |
Auto-configure coding agents (Claude Code, Codex, OpenCode, Cline, OMP) |
qpx clean |
Prune transient Chromium profile caches (~4.5MB per account) |
qpx clean:all |
Reclaim disk space from obsolete browser downloads (~4GB) |
qpx reset |
Reset rate-limit and error cooldowns in database |
qpx login |
Authenticate new accounts via visible browser |
qpx purge |
Delete remote chat history across configured accounts |
qpx update |
Automatically update QwenProxy to the latest version |
npm test |
Run complete test suite (mock & live suites) |
npm run typecheck |
Strict TypeScript verification (0 errors required) |
services:
qwenproxy:
build: .
container_name: qwenproxy
ports:
- "${PORT:-7936}:7936"
env_file:
- .env
volumes:
- ./data:/app/data
restart: unless-stopped
shm_size: "2gb"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"This software is provided "as is", without warranty of any kind, express or implied.
- No Affiliation: QwenProxy is an independent open-source project and is not affiliated with, endorsed, or sponsored by Alibaba, Qwen, OpenAI, Anthropic, or any mentioned provider.
- Educational & Personal Use: Intended for technical research and local development. Users are solely responsible for adhering to upstream Terms of Service, managing their own credentials, and complying with applicable laws.
- User Responsibility: The user assumes full responsibility for account rate limits, security challenges, and content generated.
Developed and maintained by johngbl, built on open-source foundations originally authored by Pedro Farias under the ISC License.
