MAXeaglet/commandcode-proxy

Command Code API 反代代理,兼容 OpenAI 与 Anthropic 接口 | Reverse proxy exposing Command Code API as OpenAI- and Anthropic-compatible endpoints

What it solves

Command Code's own API is proprietary and tied to its CLI. This project provides a thin reverse proxy that translates that protocol into the widely used OpenAI Chat Completions and Anthropic Messages formats, so any tool that speaks those standards (Python SDKs, Cursor, OpenCode) can call Command Code models with no custom code.

How it works

The proxy is a single Node.js file with no external dependencies. It observes the official CLI's network traffic to replicate the Command Code request protocol. On each request it performs a device-fingerprint and lifecycle pre-request, builds the CLI-style envelope (config, memory, taste, skills, permission mode, params), and forwards it to the Command Code API. It then converts the response back into OpenAI or Anthropic format, including streaming Server-Sent Events, tool calling, multimodal image input, reasoning effort mapping, and cache-hit usage metrics. It also masks anti-detection signals: per-key device fingerprints that refresh periodically, randomized session expiry, version headers auto-fetched from npm, and OpenTelemetry traceparent headers. Robustness features include client-disconnect upstream abort, zero-output and consecutive-timeout retries returning HTTP 429, and a 100 MB request body limit.

Who it's for

Developers who subscribe to Command Code and want to use its models through existing OpenAI- or Anthropic-compatible tooling — e.g. Python scripts using the official SDKs, Cursor custom providers, or OpenCode. It is explicitly for personal, educational use and is not affiliated with Command Code.

Highlights

  • Two compatibility endpoints: OpenAI Chat Completions (/v1/chat/completions) and Anthropic Messages (/v1/messages), both supporting streaming and non-streaming.
  • Automatic protocol translation: Anthropic system prompts, tool_result blocks, input_schema, tool_choice, and thinking budgets are mapped to OpenAI equivalents.
  • Dynamic model list via /v1/models with 5-minute caching and a hardcoded fallback.
  • Device fingerprint disguise and lifecycle emulation to mimic normal CLI traffic.
  • Zero-output and idle-timeout detection returning HTTP 429 so SDKs auto-retry, avoiding false billing.
  • Runs from a single file with no dependencies; Docker images for amd64 and arm64 published to GHCR.

Related

  • Project
  • Project
  • Project
  • Project