Skip to content

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

Closed

Description

@stefaneidelloth

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"
        },      
      }
    }
  }
}

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Dec 8, 2025
  2. github-actions commented on Dec 8, 2025

    @github-actions
    Contributor

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

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

  3. rekram1-node commented on Dec 8, 2025

    @rekram1-node
    Contributor

    Yeah we should fix

  4. edlsh commented on Dec 8, 2025

    @edlsh
    Contributor

    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)

  5. rekram1-node commented on Dec 11, 2025

    @rekram1-node
    Contributor

    I believe this is fixed in the next release

  6. Mte90 commented on Dec 15, 2025

    @Mte90

    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.

  7. rekram1-node commented on Dec 15, 2025

    @rekram1-node
    Contributor

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

    The config docs should help clear that up for you.

    ~/.config/opencode/opencode.json

  8. Mte90 commented on Dec 15, 2025

    @Mte90

    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.

  9. rekram1-node commented on Dec 15, 2025

    @rekram1-node
    Contributor

    yeah docs need another pass

  10. Mte90 commented on Jan 15, 2026

    @Mte90

    any hope for a documentation update?

  11. edlsh commented on Jan 20, 2026

    @edlsh
    Contributor

    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.

  12. edlsh commented on Jan 20, 2026

    @edlsh
    Contributor

    PR is up with the doc fixes: #9612

  13. mvidaldp commented on Jan 22, 2026

    @mvidaldp

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionUsed for feature requests, proposals, ideas, etc. Open discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions