Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ Tokens are valid for 90 days. The CLI will prompt you to re-authenticate when yo
| `-k, --api-key <key>` | API key for the LLM provider | From env var |
| `--provider <provider>` | API provider (roo, anthropic, openai, openrouter, etc.) | `openrouter` (or `roo` if authenticated) |
| `-m, --model <model>` | Model to use | `anthropic/claude-opus-4.6` |
| `-b, --base-url <url>` | Base URL for the LLM provider (e.g., for OpenAI-compatible APIs) | None |
| `--mode <mode>` | Mode to start in (code, architect, ask, debug, etc.) | `code` |
| `--terminal-shell <path>` | Absolute shell path for inline terminal command execution | Auto-detected shell |
| `-r, --reasoning-effort <effort>` | Reasoning effort level (unspecified, disabled, none, minimal, low, medium, high, xhigh) | `medium` |
Expand Down
8 changes: 7 additions & 1 deletion apps/cli/src/agent/extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface ExtensionHostOptions {
provider: SupportedProvider
apiKey?: string
model: string
baseUrl?: string
workspacePath: string
extensionPath: string
nonInteractive?: boolean
Expand Down Expand Up @@ -227,7 +228,12 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
experiments: {
customTools: true,
},
...getProviderSettings(this.options.provider, this.options.apiKey, this.options.model),
...getProviderSettings(
this.options.provider,
this.options.apiKey,
this.options.model,
this.options.baseUrl,
),
}

this.initialSettings = this.options.nonInteractive
Expand Down
1 change: 1 addition & 0 deletions apps/cli/src/commands/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export async function run(promptArg: string | undefined, flagOptions: FlagOption
user: null,
provider: effectiveProvider,
model: effectiveModel,
baseUrl: flagOptions.baseUrl,
workspacePath: effectiveWorkspacePath,
extensionPath: path.resolve(flagOptions.extension || getDefaultExtensionPath(__dirname)),
nonInteractive: !effectiveRequireApproval,
Expand Down
1 change: 1 addition & 0 deletions apps/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ program
.option("-k, --api-key <key>", "API key for the LLM provider")
.option("--provider <provider>", "API provider (roo, anthropic, openai, openrouter, etc.)")
.option("-m, --model <model>", "Model to use", DEFAULT_FLAGS.model)
.option("-b, --base-url <url>", "Base URL for the LLM provider (e.g., for OpenAI-compatible APIs)")
.option("--mode <mode>", "Mode to start in (code, architect, ask, debug, etc.)", DEFAULT_FLAGS.mode)
.option("--terminal-shell <path>", "Absolute path to shell executable for inline terminal commands")
.option(
Expand Down
11 changes: 11 additions & 0 deletions apps/cli/src/lib/utils/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { SupportedProvider } from "@/types/index.js"
const envVarMap: Record<SupportedProvider, string> = {
anthropic: "ANTHROPIC_API_KEY",
"openai-native": "OPENAI_API_KEY",
openai: "OPENAI_API_KEY",
gemini: "GOOGLE_API_KEY",
openrouter: "OPENROUTER_API_KEY",
"vercel-ai-gateway": "VERCEL_AI_GATEWAY_API_KEY",
Expand All @@ -24,6 +25,7 @@ export function getProviderSettings(
provider: SupportedProvider,
apiKey: string | undefined,
model: string | undefined,
baseUrl: string | undefined,
): RooCodeSettings {
const config: RooCodeSettings = { apiProvider: provider }

Expand All @@ -32,17 +34,25 @@ export function getProviderSettings(
if (apiKey) config.apiKey = apiKey
if (model) config.apiModelId = model
break
case "openai":
if (apiKey) config.openAiApiKey = apiKey
if (model) config.openAiModelId = model
if (baseUrl) config.openAiBaseUrl = baseUrl
break
case "openai-native":
if (apiKey) config.openAiNativeApiKey = apiKey
if (model) config.apiModelId = model
if (baseUrl) config.openAiNativeBaseUrl = baseUrl
break
case "gemini":
if (apiKey) config.geminiApiKey = apiKey
if (model) config.apiModelId = model
if (baseUrl) config.googleGeminiBaseUrl = baseUrl
break
case "openrouter":
if (apiKey) config.openRouterApiKey = apiKey
if (model) config.openRouterModelId = model
if (baseUrl) config.openRouterBaseUrl = baseUrl
break
case "vercel-ai-gateway":
if (apiKey) config.vercelAiGatewayApiKey = apiKey
Expand All @@ -55,6 +65,7 @@ export function getProviderSettings(
default:
if (apiKey) config.apiKey = apiKey
if (model) config.apiModelId = model
if (baseUrl) config.openAiBaseUrl = baseUrl
}

return config
Expand Down
2 changes: 2 additions & 0 deletions apps/cli/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { OutputFormat } from "./json-events.js"
export const supportedProviders = [
"anthropic",
"openai-native",
"openai",
"gemini",
"openrouter",
"vercel-ai-gateway",
Expand Down Expand Up @@ -34,6 +35,7 @@ export type FlagOptions = {
apiKey?: string
provider?: SupportedProvider
model?: string
baseUrl?: string
mode?: string
terminalShell?: string
reasoningEffort?: ReasoningEffortFlagOptions
Expand Down
Loading