Skip to content

[FEATURE]: Allow custom provider models to reference official model definitions from Models.dev #30519

@gzb1128

Description

@gzb1128

Feature hasn't been suggested before.

  • I have verified this feature I am about to request hasn't been suggested before.

Describe the enhancement you want to request

TL;DR: Allow a model in a custom provider to reference/alias an official model definition from Models.dev by ID, so limit, modalities, reasoning, interleaved, cost, etc. are inherited automatically without manual duplication.


Problem

Many users run self-hosted gateways or proxies (e.g. LiteLLM, OpenRouter-style routers, or enterprise AI hubs) that re-expose models already cataloged in Models.dev under providers like zai, moonshotai, minimax, anthropic, etc. Currently, every custom provider that offers these models must manually re-specify all model metadata:

{
  "provider": {
    "my-gateway": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://my-gateway.example.com/api/v1" },
      "models": {
        "glm-5.1": {
          "name": "GLM-5.1",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "attachment": false,
          "interleaved": { "field": "reasoning_content" },
          "modalities": { "input": ["text"], "output": ["text"] },
          "limit": { "context": 200000, "output": 131072 }
        },
        "kimi-k2.6": {
          "name": "Kimi-K2.6",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "attachment": true,
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "limit": { "context": 262144, "output": 131072 }
        },
        "MiniMax-M2.7": {
          "name": "MiniMax-M2.7",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "modalities": { "input": ["text"], "output": ["text"] },
          "limit": { "context": 204800, "output": 131072 }
        }
      }
    }
  }
}

When the same models appear under multiple custom providers, all metadata is duplicated. This is error-prone and drifts out of sync with upstream model updates.

Suggested behavior

Add a way for a model in a custom provider to reference an official model definition. Proposed syntax options:

Option A — ref field (model-level reference)

{
  "provider": {
    "my-gateway": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://my-gateway.example.com/api/v1" },
      "models": {
        "glm-5.1": {
          "ref": "zai/glm-5.1"
        },
        "kimi-k2.6": {
          "ref": "moonshotai/kimi-k2.6"
        },
        "MiniMax-M2.7": {
          "ref": "minimax/MiniMax-M2.7"
        }
      }
    }
  }
}

Option B — use id to auto-resolve from global Models.dev index

If a model id matches a known model in any Models.dev provider, automatically hydrate metadata:

{
  "provider": {
    "my-gateway": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://my-gateway.example.com/api/v1" },
      "models": {
        "glm-5.1": {},       // auto-resolved from zai/glm-5.1 in Models.dev
        "kimi-k2.6": {},     // auto-resolved from moonshotai/kimi-k2.6
        "MiniMax-M2.7": {}   // auto-resolved from minimax/MiniMax-M2.7
      }
    }
  }
}

In both options, explicit user config fields should take precedence over the referenced definition (deep merge with user wins).

Benefits

  1. DRY — no more duplicating limit, modalities, reasoning, interleaved, cost across custom providers.
  2. Accuracy — metadata stays in sync with Models.dev as upstream providers update specs.
  3. Ergonomics — adding a model to a custom gateway becomes a one-liner instead of a 10-line block.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions