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

Open
opened 2026-02-16 18:05:05 -05:00 by yindo · 7 comments
Owner

Originally created by @mcowger on GitHub (Jan 18, 2026).

Originally assigned to: @thdxr on GitHub.

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.
Originally created by @mcowger on GitHub (Jan 18, 2026). Originally assigned to: @thdxr on GitHub. ### 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 Currently, when using preconfigured providers (like Anthropic, OpenAI, etc.) with a `whitelist`, OpenCode automatically fetches model metadata (pricing, context limits, capabilities) from models.dev: ```json { "provider": { "anthropic": { "whitelist": [ "claude-sonnet-4-5", "claude-opus-4-5" ] } } } ``` However, for **custom providers**, all model metadata must be manually specified: ```json { "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: ```json { "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: ```json { "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: ```json { "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.
yindo added the discussion label 2026-02-16 18:05:05 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 18, 2026):

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

  • #6231: Auto-discover models from OpenAI-compatible provider endpoints - addresses similar problem of automating model discovery/metadata
  • #4959: Add option to disable models.dev fetch for corporate proxy environments - related to models.dev integration configuration

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

@github-actions[bot] commented on GitHub (Jan 18, 2026): This issue might be a duplicate of or related to existing issues. Please check: - #6231: Auto-discover models from OpenAI-compatible provider endpoints - addresses similar problem of automating model discovery/metadata - #4959: Add option to disable models.dev fetch for corporate proxy environments - related to models.dev integration configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@mcowger commented on GitHub (Jan 18, 2026):

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.

@mcowger commented on GitHub (Jan 18, 2026): 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.
Author
Owner

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

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

@keslerm commented on GitHub (Jan 20, 2026): @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.
Author
Owner

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

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

@mcowger commented on GitHub (Jan 20, 2026): > @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.
Author
Owner

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

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.

@mcowger commented on GitHub (Jan 22, 2026): 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.
Author
Owner

@felix-ma commented on GitHub (Jan 25, 2026):

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

@felix-ma commented on GitHub (Jan 25, 2026): In the case of intranets, this demand is particularly important. I hope to be satisfied as soon as possible
Author
Owner

@rh-anocca commented on GitHub (Feb 11, 2026):

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

@rh-anocca commented on GitHub (Feb 11, 2026): I agree this would be great to have, we use a custom proxy for hosting models and would like to have costing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6734