Skip to content

[FEATURE]: Auto-load available models from LiteLLM proxy with autoload option #13891

Closed

Description

@farukcankaya

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

Problem

When using OpenCode with a LiteLLM proxy, users must manually define every model in opencode.json. LiteLLM proxies already expose all available models via their /models endpoint (OpenAI-compatible). If the proxy has 20+ models, the config becomes tedious to maintain and goes stale as models are added/removed on the proxy side.

Proposed solution

Add an autoload: true option that works alongside litellmProxy: true. When both are set, OpenCode fetches the list of available models from the proxy's /models endpoint at startup. When only litellmProxy: true is set (without autoload), models must be defined manually as before.

Manual models only (litellmProxy: true):

{
  "provider": {
    "MyLiteLLMProxy": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My LiteLLM Proxy",
      "options": {
        "baseURL": "https://litellm.example.com/v1",
        "litellmProxy": true
      },
      "models": {
        "gpt-4": { "name": "GPT-4" },
        "anthropic/claude-opus-4-6": { "name": "anthropic/claude-opus-4-6" },
        "deepseek-chat": { "name": "DeepSeek Chat" }
      }
    }
  }
}

Auto-load all models (litellmProxy: true + autoload: true):

{
  "provider": {
    "my-proxy": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My LiteLLM Proxy",
      "options": {
        "baseURL": "https://litellm.example.com/v1",
        "litellmProxy": true,
        "autoload": true,
        "apiKey": "sk-key"
      }
    }
  }
}

Key behaviors:

  • litellmProxy: true marks the provider as a LiteLLM proxy
  • autoload: true opts into fetching models from the /models endpoint at startup
  • Both must be set for auto-loading (or provider ID contains "litellm" + autoload: true)
  • Manually configured models are never overridden (user config takes precedence)

Why this belongs in OpenCode

  • "Support for new providers" is listed as an accepted contribution type in CONTRIBUTING.md
  • LiteLLM is the most common proxy for teams running multiple LLM providers behind a single gateway
  • This removes friction for self-hosted and enterprise setups where model lists change frequently
  • Zero impact on existing users - autoload is opt-in alongside litellmProxy

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Feb 16, 2026
  2. github-actions commented on Feb 16, 2026

    @github-actions
    Contributor

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

    Both issues request the same core functionality: auto-loading model lists from an OpenAI-compatible endpoint instead of requiring manual configuration. The main difference is that #13891 is specifically scoped to LiteLLM with an opt-in autoload flag, while #6231 discusses broader auto-discovery for all OpenAI-compatible providers.

    These may be candidates for consolidation or alignment in implementation.

  3. R44VC0RP commented on Feb 16, 2026

    @R44VC0RP
    Contributor

    Good idea, going to close this for now, once we get more requests for this we can reopen.

  4. reopened this on Feb 16, 2026
  5. farukcankaya commented on Feb 17, 2026

    @farukcankaya
    Author

    i probably missed the previously opened issues/PRs because I searched with litellm focus. I saw that this comment summarizes the need and related parallel works: #6231 (comment)

    please let me know if there’s anything I can do on my side. I’d be happy to contribute.

  6. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  7. yuseferi commented on Apr 27, 2026

    @yuseferi

    I've been waiting for this for a while, nothing happened, then I created a plugin for that, https://github.com/yuseferi/opencode-litellm

  8. espetro commented on Apr 27, 2026

    @espetro

    @yuseferi does your plugin also work with any other OpenAI-compatible providers? I want to use it for my LMStudio local setup.

  9. yuseferi commented on Apr 27, 2026

    @yuseferi

    @espetro, actually, there is a specific one for LMStudio local; it didn't work for Litellm for me, so based on that, I created one for Litellm. 😄
    you can find it here https://github.com/agustif/opencode-lmstudio

  10. yuseferi commented on Apr 27, 2026

    @yuseferi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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