#2194·openclaude

feat(provider): add Command Code (commandcode.ai) as a first-class provider

Author: dlivxprCreated Sep 2, 2026Updated Sep 2, 2026
Labelsnew: provider/gateway

Summary

Request to add Command Code (Provider API / GOAT & Pro Plans) as a first-class provider in OpenClaude.

Command Code provides unified access to 30+ top open-source and closed-source models (DeepSeek, GLM, MiniMax, Kimi, Claude, GPT, etc.) with prompt caching, usage-based metering, and standard OpenAI / Anthropic compatibility.


Provider Technical Specifications

  • Provider ID: commandcode
  • Base URL: https://api.commandcode.ai/provider/v1
  • Authentication:
    • Environment Variable: CMD_API_KEY (fallback: COMMANDCODE_API_KEY)
    • Header: Authorization: Bearer <CMD_API_KEY> (also supports x-api-key: <CMD_API_KEY> for Anthropic endpoint)
    • Security: Restrict via dedicatedCredentialsOnly: true to prevent generic OPENAI_API_KEY cross-contamination.
  • Dual-Endpoint Contract:
    • OpenAI / Open-Source Models (e.g., deepseek/deepseek-v4-flash, moonshotai/kimi-k2.5):
      • Endpoint: POST https://api.commandcode.ai/provider/v1/chat/completions
      • Format: OpenAI Chat Completions schema (streaming supported with stream_options: {"include_usage": true}).
    • Anthropic Claude Models (e.g., claude-sonnet-5, claude-sonnet-4-6):
      • Endpoint: POST https://api.commandcode.ai/provider/v1/messages
      • Format: Native Anthropic Messages schema (usage emitted via message_delta).
    • Note: Command Code strictly returns 400 if Claude models are sent to /chat/completions or vice versa.
  • Model Discovery:
    • Endpoint: GET https://api.commandcode.ai/provider/v1/models
    • Default Fallback Model: deepseek/deepseek-v4-flash
  • Optional Headers:
    • x-cmd-zdr: 1 (Enforces zero data retention / no-training mode when enabled).

Proposed Implementation

  1. Descriptor (src/integrations/):
    • Register a commandcode gateway/vendor descriptor with CMD_API_KEY credential setup.
    • Configure model discovery pointing to https://api.commandcode.ai/provider/v1/models.
    • Implement route-level transport selection: route Claude model identifiers to the Anthropic Messages transport, and OpenAI/open-source models to the OpenAI-compatible shim.
  2. Interactive Preset (/provider):
    • Add Command Code to the interactive /provider setup wizard.
    • Support startup auto-detection when CMD_API_KEY is present in the environment.
  3. CLI & Profile Integration:
    • Support --provider commandcode and persistent provider profiles.

Acceptance Criteria

  • commandcode appears in /provider interactive setup and --provider commandcode CLI flag.
  • Correct credential isolation (CMD_API_KEY is not leaked or overridden by generic OPENAI_API_KEY).
  • Dynamic model catalog is fetched from https://api.commandcode.ai/provider/v1/models.
  • OpenAI/open-source models route cleanly to /v1/chat/completions and Claude models to /v1/messages.
  • Unit tests, lint, and typechecks pass.

References