Repository navigation
Description
Summary
Add a "Custom Provider" flow in the TUI /connect command palette that lets users register any provider by entering an endpoint and optional API key, auto-discovers available models, and lets users select which models to enable.
Motivation
OpenCode has many built-in providers, but users frequently need to add:
- Self-hosted models (Ollama, vLLM, LocalAI, etc.)
- Third-party platforms (DeepSeek, Qwen, Kimi, etc.)
- Corporate/internal API gateways
- Any OpenAI-compatible endpoint
Currently this requires manually editing opencode.jsonc with the correct schema, npm package name, and model capabilities — which is error-prone and not discoverable.
Proposed Behavior
In the TUI, invoke /connect (or a new command like /add-provider) and present an interactive flow:
Step 1: Endpoint
Provider endpoint URL: https://api.deepseek.com/v1
- Accept any URL (local or remote)
- Validate the URL is reachable
Step 2: API Key (optional)
API key (leave empty for no auth): ****
- Key is optional because:
- Local providers (Ollama, LocalAI) typically don't need a key
- Some platforms return different model lists based on whether a key is provided
- Key should be stored securely (not in plain text in config if possible)
Step 3: Auto-fetch Models
After entering endpoint + key, automatically call the provider's model list endpoint (e.g., /v1/models) to discover available models.
Fetching models from https://api.deepseek.com/v1/models ...
Available models:
[x] deepseek-chat (context: 64000, output: 8000)
[x] deepseek-reasoner (context: 64000, output: 8000)
[ ] deepseek-v3 (context: 128000, output: 16000)
[ ] deepseek-v2.5 (context: 32000, output: 4000)
Select models to enable (space to toggle, enter to confirm):
- Pre-select all models, let user deselect unwanted ones
- Show model name and basic info (context window, output limit) when available
- If the endpoint doesn't support
/v1/models, fall back to manual model name input
Step 4: Confirm & Save
Provider: deepseek
Endpoint: https://api.deepseek.com/v1
Models: deepseek-chat, deepseek-reasoner
Save to: [Global ~/.config/opencode/opencode.jsonc] / [Project .opencode/opencode.jsonc]
Confirm? (y/n)
Technical Notes
- The
/v1/modelsendpoint is part of the OpenAI API spec and supported by most compatible providers - For providers that don't support model listing, fall back to manual model name entry
- The config should use
@ai-sdk/openai-compatiblenpm package as the adapter - Consider supporting other adapter packages in the future (e.g.,
@ai-sdk/anthropic,@ai-sdk/google) if the endpoint is detected
Expected Config Output
After completing the flow, the following should be written to opencode.jsonc:
{
"providers": {
"deepseek": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "sk-xxx",
"baseURL": "https://api.deepseek.com/v1"
},
"models": {
"deepseek-chat": {
"name": "deepseek-chat",
"tool_call": true,
"limit": { "context": 64000, "output": 8000 }
},
"deepseek-reasoner": {
"name": "deepseek-reasoner",
"reasoning": true,
"tool_call": true,
"limit": { "context": 64000, "output": 8000 }
}
}
}
}
}Environment
- opencode version: 2.0.3
- OS: Windows_NT 10.0.26200 (win32 x64)
- Terminal: TUI mode
Additional Context
This feature would make OpenCode much more accessible for users who don't want to manually edit JSON configs. The /connect palette is the natural place for this since it already handles provider connections.
Activity
github-actions commentedon Sep 14, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:and include a verification checkbox confirming the feature hasn't been suggested before.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
/connectto enter an OpenAI-compatible base URL, API key, and save to configIf you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Sep 14, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.