Repository navigation
Description
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-urlfor 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
-mpass-through sidesteps that but may accept model ids the endpoint rejects. - Extending the shared
ProviderDefinitiontype touches the VS Code extension too, so any new fields must be optional/additive.
Activity
[-][ENHANCEMENT] CLI: native Windows install and build support[/-][+][ENHANCEMENT] CLI: inherit providers and configuration from the main app[/+]martin-rueegg commentedon Aug 14, 2026
Action Plan: CliProviderInheritance v1.0: inherit provider registry
Discussion
The main app centralizes provider knowledge in
@roo-code/types:providerDefinitionListregisters ~35 providers, each aProviderDefinitioncarryingapiProvider, a ZodsettingsShape(API key, base URL, model id, …),modelIdKey, andgetModelId.provider-settings.tsexposesproviderNames,isProviderName,providerNamesSchema, andgetModelId. The extension bundle already implements every handler insrc/api/providers/*.The CLI ignores all of that and re-implements a 5-provider subset:
supportedProviders/SupportedProviderinapps/cli/src/types/types.ts, a 5-entryenvVarMap+ manualgetProviderSettingsswitch inapps/cli/src/lib/utils/provider.ts, a validation gate inapps/cli/src/commands/cli/run.ts, and per-provider model-key handling inapps/cli/src/lib/utils/context-window.ts. The settings the CLI builds flow intoRooCodeSettingsinapps/cli/src/agent/extension-host.ts, which the full extension consumes.The goal is to make the CLI inherit the shared registry and configuration instead of maintaining its own list. This unlocks every provider (notably DeepSeek, which already declares
deepSeekApiKey/deepSeekBaseUrl/apiModelIdindeepseek.ts) for free.Analysis
What changes
apps/cli/src/types/types.tssupportedProviders/SupportedProvider; use sharedProviderName+isProviderNameapps/cli/src/lib/utils/provider.tsenvVarMap+getProviderSettingsswitch with data-driven construction from the activeProviderDefinition.settingsShapeapps/cli/src/index.ts/run.ts--base-urlflag; validate provider viaisProviderName; pass base URL throughpackages/types/src/provider-settings/common.tsenvVar/defaultBaseUrlmetadata toProviderDefinition(additive)apps/cli/src/lib/utils/context-window.tsgetModelId/modelIdKeysByProviderapps/cli/README.md,apps/cli/CHANGELOG.md--base-url; changelog entryScope
--providervalidation, settings construction, and base-URL/key/model mapping; add--base-url; enable all shared providers.-mpass-through).Implementation Plan
Block 1 — Replace the provider allowlist with the shared registry
supportedProviders/SupportedProvider/isSupportedProviderfromapps/cli/src/types/types.ts; typeFlagOptions.provider/CliSettings.providerasProviderName.run.ts, validate withisProviderNameand report valid values fromproviderNames.Verification:
npx tsc --noEmitand the existingtypes/runsuites pass;--provider deepseekis no longer rejected by the gate.Block 2 — Data-driven provider settings
provider.tsto resolve the activeProviderDefinitionand write the provider's own fields (API key, base URL, model id) intoRooCodeSettingsvia itssettingsShapekeys — replacing the manual switch.Verification: updated
provider.test.tsgreen; a DeepSeek case producesdeepSeekApiKey/deepSeekBaseUrl/apiModelId; the five existing providers produce the same fields as before.Block 3 —
--base-urlflagindex.ts, theFlagOptionsfield,run.tswiring, and map it to the active provider's base-URL setting inprovider.ts.Verification:
roo --helplists--base-url; a unit test asserts it lands in the provider's base-URL field.Block 4 — Optional provider metadata in shared types
ProviderDefinitionwith optionalenvVar/defaultBaseUrl(additive) incommon.ts; backfill for the existing providers; use it for env-var resolution in the CLI.Verification:
packages/typessuites pass; extension type-check unaffected.Block 5 — Remove remaining per-provider special cases
context-window.tsusing sharedgetModelId/modelIdKeysByProvider; fix anylist/onboarding code that assumes the 5-provider set.Verification: full
apps/cliVitest suite green;list/onboarding tests pass.Block 6 — Docs and changelog
README.md(provider/env-var table,--base-url, DeepSeek example) and add an Unreleased entry toCHANGELOG.md.Verification: docs render; changelog reflects the change.
Proposed commit message
Change History
[-][ENHANCEMENT] CLI: inherit providers and configuration from the main app[/-][+][CLI] inherit providers and configuration from the main app[/+]