opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Add custom provider support to /connect

Open opencode-agent[bot] opened this issue 4 weeks ago • 2 comments

I've fixed the /connect command in the TUI to support custom providers. Here's a summary of the changes:

Changes Made

File: packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx

1. Added "Other" option to the provider list

The provider selection dialog now includes an "Other" option at the end of the list under the "Other" category. This matches the behavior of the CLI auth login command.

2. Added CustomProviderMethod component

A new component that implements a two-step flow for custom providers:

  1. Step 1: Prompts for a provider ID (with validation for a-z, 0-9, and hyphens only, same as CLI)
  2. Step 2: Prompts for the API key with a warning message that the user will need to configure the provider in opencode.json

The implementation mirrors the CLI's behavior including:

  • Stripping the @ai-sdk/ prefix if present
  • Validating provider ID format
  • Showing the same configuration warning message

Now when users run /connect in the TUI, they'll see "Other (Custom provider)" at the bottom of the provider list, which allows them to add credentials for any OpenAI-compatible provider.

Closes #5937

New%20session%20-%202025-12-23T06%3A11%3A49.345Z opencode session  |  github run

opencode-agent[bot] avatar Dec 23 '25 06:12 opencode-agent[bot]

/review

rekram1-node avatar Dec 23 '25 06:12 rekram1-node

lgtm

github-actions[bot] avatar Dec 23 '25 06:12 github-actions[bot]