Add custom provider support to /connect
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:
-
Step 1: Prompts for a provider ID (with validation for
a-z,0-9, and hyphens only, same as CLI) -
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
opencode session | github run
/review
lgtm