Skip to content

Support custom API base URL and API key (OpenAI-compatible provider) #640

Description

@JinzoU-MwM

Feature Request

Allow commandcode to use a custom API base URL and API key from external providers (e.g. any OpenAI-compatible gateway), instead of being hardwired to api.commandcode.ai.

Motivation

Right now all models are routed through Command Code's own backend (api.commandcode.ai). Users on other providers — or self-hosted / relay gateways that expose an OpenAI-compatible /v1 endpoint — cannot point commandcode at them. The only knob that exists, COMMANDCODE_API_URL, switches between Command Code's own prod/staging/local environments; it does not accept an external provider base URL.

Proposed behavior

Something like the existing opencode / Claude Code config model:

  • A config file and/or env vars, e.g.:
    • COMMANDCODE_BASE_URL=https://my-provider.example.com/v1
    • COMMANDCODE_API_KEY=sk-...
  • Optional custom model list (id → display name, context window, modalities) when pointing at a non-Command-Code backend.
  • Priority: CLI flag > config file > env var > current auth.

Use case

I maintain an opencode.jsonc with a custom provider (npm: @ai-sdk/openai-compatible, baseURL + apiKey) and would love to drive commandcode with the same endpoint/key instead of a separate Command Code subscription key.

Environment

  • commandcode 1.11.0
  • Linux, Node v26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions