You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Include custom providers in /provider and /connect command #5250
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
I defined a custom provider in my opencode.jsonc file (see below example).
If I start opencode and use the /provider command, I would expect my custom provider "fhgenie" to be shown in the list of providers. Howerver, it is not shown.
I would like to connect to my custom provider similar to github copilot provider, specifying some credentials in the command line.... that are stored as secret.
Currently I hard code my api key in opencode.jsonc. I am able to connect to the models using /models command.
=> Could you please support custom providers for the /provider and /connect command and clarify how to fully specify custom providers, including authentication?
Expected behavior: an improved config could support a syntax like
"Authorization": "Bearer ${secret.fhgenie}"
If the cutom secret does not yet exist, opencode asks for it and saves it as a secret.
Hi, I'd like to work on this issue. cc @rekram1-node
Scope for initial PR:
I'm proposing to handle the first part of this request - making custom providers visible in /provider and /connect commands with API key auth support.
Changes:
Modify the /provider endpoint to merge custom providers from config alongside models.dev providers
Add default API key auth method for custom providers in ProviderAuth.methods()
This would allow users to:
See their custom providers in /connect
Connect via API key (stored securely like other providers)
Out of scope (for now):
The ${secret.xxx} template syntax for config interpolation is a larger feature that would benefit from separate design discussion - recommend a follow-up issue for that.
Estimated effort: ~20-30 lines across 2 files (server/server.ts, provider/auth.ts)
Docs update in progress: clarified custom provider config can live in global (~/.config/opencode/opencode.json) or project opencode.json (merged, project overrides), and added explicit OpenAI-compatible example with options.baseURL (host), apiKey, headers in /docs/config plus tweaks in /docs/providers. This should address the host parameter + global config confusion.
I tested @stefaneidelloth’s config using an OpenAI-compatible custom provider (LiteLLM). I found that /connect then works, storing the key as apiKey inside options.
However, the key is still requested (even though it isn’t used, since the one defined in opencode.json is read instead). It would be great to have a fix that automatically skips asking for the key when it is already provided in opencode.json.
I also realized that although the api key from opencode.json is the one read, it actually stores what you input every time you /connect then on auth.json
Activity
github-actions commentedon Dec 8, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Dec 8, 2025
Yeah we should fix
edlsh commentedon Dec 8, 2025
Hi, I'd like to work on this issue. cc @rekram1-node
Scope for initial PR:
I'm proposing to handle the first part of this request - making custom providers visible in
/providerand/connectcommands with API key auth support.Changes:
/providerendpoint to merge custom providers from config alongside models.dev providersProviderAuth.methods()This would allow users to:
/connectOut of scope (for now):
The
${secret.xxx}template syntax for config interpolation is a larger feature that would benefit from separate design discussion - recommend a follow-up issue for that.Estimated effort: ~20-30 lines across 2 files (
server/server.ts,provider/auth.ts)rekram1-node commentedon Dec 11, 2025
I believe this is fixed in the next release
Mte90 commentedon Dec 15, 2025
It is not clear if to set a custom provider globally on the machine (and not for project) how to do it https://opencode.ai/docs/providers/#custom-provider
The guide mention
opencode.jsonbut is a project file and not a global one.rekram1-node commentedon Dec 15, 2025
https://opencode.ai/docs/config/#global
The config docs should help clear that up for you.
~/.config/opencode/opencode.json
Mte90 commentedon Dec 15, 2025
I checked that page but there is no field like for my custom key to specify the host parameter.
Also checking the custom-provider section I should expect some info about what are the parameters in the config and a redirect to the page.
rekram1-node commentedon Dec 15, 2025
yeah docs need another pass
Mte90 commentedon Jan 15, 2026
any hope for a documentation update?
edlsh commentedon Jan 20, 2026
Docs update in progress: clarified custom provider config can live in global (~/.config/opencode/opencode.json) or project opencode.json (merged, project overrides), and added explicit OpenAI-compatible example with options.baseURL (host), apiKey, headers in /docs/config plus tweaks in /docs/providers. This should address the host parameter + global config confusion.
edlsh commentedon Jan 20, 2026
PR is up with the doc fixes: #9612
mvidaldp commentedon Jan 22, 2026
I tested @stefaneidelloth’s config using an OpenAI-compatible custom provider (LiteLLM). I found that
/connectthen works, storing the key asapiKeyinsideoptions.However, the key is still requested (even though it isn’t used, since the one defined in
opencode.jsonis read instead). It would be great to have a fix that automatically skips asking for the key when it is already provided inopencode.json.I also realized that although the api key from
opencode.jsonis the one read, it actually stores what you input every time you/connectthen onauth.json