[FEATURE]: Include custom providers in /provider and /connect command #3408

Closed
opened 2026-02-16 17:39:58 -05:00 by yindo · 12 comments
Owner

Originally created by @stefaneidelloth on GitHub (Dec 8, 2025).

Feature hasn't been suggested before.

  • 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.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "fhgenie": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "FhGenie",
      "options": {
        "baseURL": "https://fhgenie.foo.de/v1",
        "headers": {
          "Authorization": "Bearer ***"
        }
      },
      "models": {
        "Kimi-K2-Thinking": {
          "name": "Kimi-K2-Thinking"
        },      
      }
    }
  }
}
Originally created by @stefaneidelloth on GitHub (Dec 8, 2025). ### Feature hasn't been suggested before. - [x] 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. ``` { "$schema": "https://opencode.ai/config.json", "provider": { "fhgenie": { "npm": "@ai-sdk/openai-compatible", "name": "FhGenie", "options": { "baseURL": "https://fhgenie.foo.de/v1", "headers": { "Authorization": "Bearer ***" } }, "models": { "Kimi-K2-Thinking": { "name": "Kimi-K2-Thinking" }, } } } } ```
yindo added the discussion label 2026-02-16 17:39:58 -05:00
yindo closed this issue 2026-02-16 17:39:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 8, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3735: [FEATURE]: CLI Providers - Related request to support additional provider types in selection dialogs
  • #1555: LM Studio Missing as Provider, custom provider for LM Studio non-functional - Similar issue with custom providers not appearing in provider selection
  • #5210: Custom OpenAI-compatible provider returns no text content - Related issue with custom provider configuration and functionality
  • #5163: Custom baseURL configuration returns "Route /api/messages not found" error - Related issue with custom provider baseURL configuration
  • #1298: Getting an issue integrating a custom provider: AI_TypeValidationError - Similar custom provider integration issue
  • #4533: opencode auth list shows "undefined" for $schema and provider fields despite valid configuration - Related to custom provider configuration display
  • #1597: Improve provider and API key update workflow after initial setup - Related feature request for provider management workflow

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 8, 2025): This issue might be a duplicate of existing issues. Please check: - #3735: [FEATURE]: CLI Providers - Related request to support additional provider types in selection dialogs - #1555: LM Studio Missing as Provider, custom provider for LM Studio non-functional - Similar issue with custom providers not appearing in provider selection - #5210: Custom OpenAI-compatible provider returns no text content - Related issue with custom provider configuration and functionality - #5163: Custom baseURL configuration returns "Route /api/messages not found" error - Related issue with custom provider baseURL configuration - #1298: Getting an issue integrating a custom provider: AI_TypeValidationError - Similar custom provider integration issue - #4533: opencode auth list shows "undefined" for $schema and provider fields despite valid configuration - Related to custom provider configuration display - #1597: Improve provider and API key update workflow after initial setup - Related feature request for provider management workflow Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 8, 2025):

Yeah we should fix

@rekram1-node commented on GitHub (Dec 8, 2025): Yeah we should fix
Author
Owner

@edlsh commented on GitHub (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 /provider and /connect commands with API key auth support.

Changes:

  1. Modify the /provider endpoint to merge custom providers from config alongside models.dev providers
  2. 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)

@edlsh commented on GitHub (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 `/provider` and `/connect` commands with API key auth support. **Changes:** 1. Modify the `/provider` endpoint to merge custom providers from config alongside models.dev providers 2. 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`)
Author
Owner

@rekram1-node commented on GitHub (Dec 10, 2025):

I believe this is fixed in the next release

@rekram1-node commented on GitHub (Dec 10, 2025): I believe this is fixed in the next release
Author
Owner

@Mte90 commented on GitHub (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.json but is a project file and not a global one.

@Mte90 commented on GitHub (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.json` but is a project file and not a global one.
Author
Owner

@rekram1-node commented on GitHub (Dec 15, 2025):

https://opencode.ai/docs/config/#global

The config docs should help clear that up for you.

~/.config/opencode/opencode.json

@rekram1-node commented on GitHub (Dec 15, 2025): https://opencode.ai/docs/config/#global The config docs should help clear that up for you. ~/.config/opencode/opencode.json
Author
Owner

@Mte90 commented on GitHub (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.

@Mte90 commented on GitHub (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.
Author
Owner

@rekram1-node commented on GitHub (Dec 15, 2025):

yeah docs need another pass

@rekram1-node commented on GitHub (Dec 15, 2025): yeah docs need another pass
Author
Owner

@Mte90 commented on GitHub (Jan 15, 2026):

any hope for a documentation update?

@Mte90 commented on GitHub (Jan 15, 2026): any hope for a documentation update?
Author
Owner

@edlsh commented on GitHub (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 commented on GitHub (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.
Author
Owner

@edlsh commented on GitHub (Jan 20, 2026):

PR is up with the doc fixes: https://github.com/anomalyco/opencode/pull/9612

@edlsh commented on GitHub (Jan 20, 2026): PR is up with the doc fixes: https://github.com/anomalyco/opencode/pull/9612
Author
Owner

@mvidaldp commented on GitHub (Jan 22, 2026):

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

@mvidaldp commented on GitHub (Jan 22, 2026): 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`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3408