Skip to content

[ENHANCEMENT] CLI: inherit providers and configuration from the main app #1246

Description

@martin-rueegg

Problem (one or two sentences)

The Roo Code CLI only supports five hard-coded providers — Anthropic, OpenAI, Gemini, OpenRouter, and Vercel AI Gateway — even though the full Roo Code app supports ~35. Users who already hold direct credentials for DeepSeek, Mistral, xAI, Qwen, and others cannot use them from the CLI, forcing them through OpenRouter or off the CLI entirely.

Context (who is affected and when)

Automation-focused developers and CLI-first users who have API keys for a provider that is not in the CLI's shortlist. This bites immediately when someone runs roo --provider deepseek ... (rejected as invalid) or wants to point an OpenAI-compatible client at their own endpoint.

Desired behavior (conceptual, not technical)

The CLI should accept every provider the main app supports, and let users supply that provider's API key, model, and (where relevant) endpoint — without the CLI maintaining its own separate provider list.

Constraints / preferences

  • No duplicated provider definitions; reuse the single source of truth already in the shared types package.
  • Keep the existing flags ergonomic: --provider, --api-key, -m/--model; add a --base-url for providers whose endpoint differs.
  • The existing five providers must keep working unchanged.

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Acceptance criteria

Given a built CLI:

  • When I run roo --provider deepseek -m deepseek-chat --base-url https://api.deepseek.com -k sk-... "hello", then the CLI targets DeepSeek's API directly (no OpenRouter).
  • When I run roo --provider <any provider known to the main app>, then it is accepted without a hard-coded allowlist.
  • When I use the existing five providers, then behavior is unchanged.
  • But when I pass an unknown provider id, then the CLI still rejects it with a clear error listing valid values.

Proposed approach

Replace the CLI's hand-maintained supportedProviders, envVarMap, and the getProviderSettings switch with the shared registry (providerNames, isProviderName, providerDefinitionList) from @roo-code/types. For the active provider, populate its own settings fields (API key, base URL, model id) from its settingsShape, and add an optional --base-url flag that writes to that provider's base-URL field. Optionally attach envVar/defaultBaseUrl metadata to ProviderDefinition so env-var lookup is also data-driven.

Trade-offs / risks

  • A few providers require extra inputs beyond key/model/base URL (e.g. Kimi Code auth method, OpenAI Codex service tier, Z.AI API line); these can be opt-in flags rather than fully generic.
  • Dynamic providers normally fetch remote model lists; the CLI's -m pass-through sidesteps that but may accept model ids the endpoint rejects.
  • Extending the shared ProviderDefinition type touches the VS Code extension too, so any new fields must be optional/additive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions