Skip to content

[FEATURE]: Use models.dev data for custom providers #9311

Closed

Description

@mcowger

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

Currently, when using preconfigured providers (like Anthropic, OpenAI, etc.) with a whitelist, OpenCode automatically fetches model metadata (pricing, context limits, capabilities) from models.dev:

{
  "provider": {
    "anthropic": {
      "whitelist": [
        "claude-sonnet-4-5",
        "claude-opus-4-5"
      ]
    }
  }
}

However, for custom providers, all model metadata must be manually specified:

{
  "provider": {
    "customprovider": {
      "name": "AI Home",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:AIHOME_API_KEY}",
        "baseURL": "https://api.example.com"
      },
      "models": {
        "minimax/minimax-m2.1": {
          "limit": { "context": 1000000, "output": 32000 },
          "cost": { "input": 0.3, "output": 1.2 },
          "temperature": true,
          "reasoning": true,
          "tool_call": true
        }
      }
    }
  }
}

This is tedious, error-prone, and requires tracking pricing/limit changes manually.

Proposed Solution

Add a use_models_dev option that allows custom providers to reference model metadata from models.dev:

{
  "provider": {
    "customprovider": {
      "name": "AI Home",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:API_KEY}",
        "baseURL": "https://api.example.com"
      },
      "models": {
        "minimax/minimax-m2.1": {
          "use_models_dev": "openrouter/minimax/minimax-m2.1"
        }
      }
    }
  }
}

This would automatically import:

  • Context/input/output limits
  • Pricing (input, output, cache read/write)
  • Capabilities (tool calls, reasoning, temperature, attachments)
  • Modalities (text, image, audio, video, PDF support)
  • Variants and other metadata

Benefits

  1. Less Configuration - No need to manually track pricing and limits
  2. Auto-Updates - When models.dev updates pricing or limits, OpenCode automatically uses latest values
  3. Accuracy - Ensures metadata matches the source provider
  4. Flexibility - Can still override specific fields when needed

User Override Support

Users should be able to override imported metadata:

{
  "models": {
    "minimax/minimax-m2.1": {
      "use_models_dev": "openrouter/minimax/minimax-m2.1",
      "limit": {
        "context": 500000  // Override imported value
      }
    }
  }
}

Merge priority: user config > models.dev import > defaults

Error Handling

If the specified use_models_dev model ID is not found in models.dev:

  • Log a warning with the invalid ID
  • List available providers to help user find correct ID
  • Fall back to any manually specified metadata in config
  • Don't crash or fail config loading

Finding Model IDs

Model IDs follow the format: provider/model-name
Examples:

  • openrouter/minimax/minimax-m2.1
  • openrouter/anthropic/claude-3.7-sonnet
  • anthropic/claude-opus-4-5
    Users can find valid IDs at https://models.dev/

Use Cases

  • Proxy providers - Using OpenRouter, AI Gateway, or other proxies that support models already in models.dev
  • Self-hosted deployments - Running models locally that match commercial offerings
  • Testing - Quickly switching between providers without reconfiguring metadata
  • Multi-provider setups - Accessing the same model through different endpoints

Example: Real-world scenario

A user wants to access Minimax M2.1 through their self-hosted AI proxy. Instead of manually looking up and copying all the metadata, they can simply reference the OpenRouter version:

{
  "provider": {
    "my-ai-proxy": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:MY_PROXY_KEY}",
        "baseURL": "https://my-proxy.internal/v1"
      },
      "models": {
        "minimax-m2.1": {
          "use_models_dev": "openrouter/minimax/minimax-m2.1"
        }
      }
    }
  }
}

All pricing, limits, and capabilities are automatically imported from models.dev.

Non-Goals

  • This feature does NOT add new models to models.dev
  • This feature does NOT validate that the provider actually supports the model
  • This feature does NOT change how preconfigured providers work.

Activity

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

    @github-actions
    Contributor

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

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

  3. mcowger commented on Jan 18, 2026

    @mcowger
    Author

    I have a PR prepared for this that works for me, but per the CONTRIBUTING.md guidance I'm opening this as a discussion prior to posting the PR.

  4. keslerm commented on Jan 20, 2026

    @keslerm

    @mcowger this would be really helpful as I use a lot of internal LLM proxies and have to keep manually configuring the prices and passing config files around.

  5. mcowger commented on Jan 20, 2026

    @mcowger
    Author

    @mcowger this would be really helpful as I use a lot of internal LLM proxies and have to keep manually configuring the prices and passing config files around.

    This is the same issue for me. I do have it working so hopefully the team agrees.

  6. mcowger commented on Jan 22, 2026

    @mcowger
    Author

    Hey @thdxr - any thoughts on if the team is supportive of this idea? If so I do have a PR that implements it and works well for my scenario.

  7. felix-ma commented on Jan 26, 2026

    @felix-ma

    In the case of intranets, this demand is particularly important. I hope to be satisfied as soon as possible

  8. rh-anocca commented on Feb 11, 2026

    @rh-anocca

    I agree this would be great to have, we use a custom proxy for hosting models and would like to have costing.

  9. github-actions commented on Apr 13, 2026

    @github-actions
    Contributor

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

  10. yuhp commented on Sep 11, 2026

    @yuhp

    The community plugin already supports enriching custom-provider models from models.dev:

    https://github.com/yuhp/opencode-models-discovery

    Configure:

    {
      "plugin": ["opencode-models-discovery@latest"],
      "provider": {
        "custom-provider": {
          "npm": "@ai-sdk/openai-compatible",
          "options": {
            "baseURL": "https://proxy.example.com/v1",
            "modelsDiscovery": {
              "enabled": true,
              "modelInfoFormat": "models.dev"
            }
          }
        }
      }
    }

    The plugin fetches models.dev metadata and applies matching limits, capabilities, modalities, and other supported OpenCode model fields to discovered models. Explicit provider configuration remains authoritative.

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