You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add vllm backend support (#47)
* `npm audit fix`
* Refactor to use an enum instead for ModelInfoFormat
* Add support for vLLM-compatible-backed endpoints to provide model context length
* Trim unnecessary tests
* Remove input limit
* Revert "`npm audit fix`"
This reverts commit d5d98a2.
* test: align vLLM limit expectation
---------
Co-authored-by: yuhp <yu.haip@gmail.com>
* docs: document vLLM model info enrichment
* chore: bump version to 1.1.0
---------
Co-authored-by: Adele <virepri2k@gmail.com>
Co-authored-by: yuhp <yu.haip@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/configuration.md
+31-2Lines changed: 31 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Each provider can configure discovery behavior through `provider.<name>.options.
39
39
|`provider.<name>.options.modelsDiscovery.enabled`|`boolean`| Force enable or disable discovery for a single provider |
40
40
|`provider.<name>.options.modelsDiscovery.endpoint`|`string`| Provider-specific models endpoint path. Defaults to `/v1/models`|
41
41
|`provider.<name>.options.modelsDiscovery.modelInfoEndpoint`|`string`| Provider-specific model info endpoint path. Metadata enrichment is disabled when omitted |
42
-
|`provider.<name>.options.modelsDiscovery.modelInfoFormat`|`string`| Model info response format. Currently supports `"litellm"` and `"models.dev"`|
42
+
|`provider.<name>.options.modelsDiscovery.modelInfoFormat`|`string`| Model info response format. Currently supports `"litellm"`, `"models.dev"`, and `"vllm"`|
43
43
|`provider.<name>.options.modelsDiscovery.filterNonChat`|`boolean`| When model info is available, skip models whose `model_info.mode` is not `chat`. Defaults to `true`|
44
44
|`provider.<name>.options.modelsDiscovery.models.includeRegex`|`string[]`| Shortcut regex allow-list for discovered model ids only |
45
45
|`provider.<name>.options.modelsDiscovery.models.excludeRegex`|`string[]`| Shortcut regex deny-list for discovered model ids only |
@@ -145,12 +145,13 @@ Community provider examples live in [`docs/config_example/`](config_example/).
145
145
146
146
The generic OpenAI-compatible `/v1/models` endpoint only guarantees a small model list shape. Extra metadata such as context limits, tool calling, reasoning, image input, or structured output is provider-specific, so metadata enrichment is opt-in.
147
147
148
-
The plugin currently supports two model info formats:
148
+
The plugin currently supports three model info formats:
149
149
150
150
| Format | Source | Requires `modelInfoEndpoint`| Notes |
|`"litellm"`| Provider-specific model info endpoint | Yes | Uses LiteLLM `/v1/model/info` responses |
153
153
|`"models.dev"`|`https://models.dev/models.json`| No | Uses the public models.dev metadata index |
154
+
|`"vllm"`| Fields in the provider's `/v1/models` response | No | Reads vLLM-style `max_model_len` when present |
154
155
155
156
### LiteLLM Model Info
156
157
@@ -187,6 +188,34 @@ When model info is available, the plugin uses LiteLLM `model_info` fields to pop
187
188
-`supports_*_reasoning_effort` and `supported_openai_params` create reasoning `variants`
188
189
- By default, entries whose `model_info.mode` is not `chat` are skipped
189
190
191
+
### vLLM Model Info
192
+
193
+
Use `modelInfoFormat: "vllm"` for a vLLM-compatible provider whose `/v1/models` response includes a numeric `max_model_len` field for each model. This does not make another metadata request.
194
+
195
+
```json
196
+
{
197
+
"plugin": ["opencode-models-discovery"],
198
+
"provider": {
199
+
"local-vllm": {
200
+
"npm": "@ai-sdk/openai-compatible",
201
+
"name": "Local vLLM",
202
+
"options": {
203
+
"baseURL": "http://127.0.0.1:8000/v1",
204
+
"modelsDiscovery": {
205
+
"enabled": true,
206
+
"modelInfoFormat": "vllm"
207
+
}
208
+
},
209
+
"models": {}
210
+
}
211
+
}
212
+
}
213
+
```
214
+
215
+
For each discovered model with a positive numeric `max_model_len`, the plugin sets `limit.context` and `limit.output` to that value. `max_model_len` represents the total request sequence length shared by prompt and generated tokens; it is not used as an independent input limit.
216
+
217
+
`max_model_len` is not part of the standard OpenAI-compatible `/v1/models` response. If a vLLM deployment or proxy does not expose it, discovery still succeeds but no limit is added. This format does not infer reasoning, tool-calling, modalities, or other capabilities.
218
+
190
219
### models.dev Metadata
191
220
192
221
Use `modelInfoFormat: "models.dev"` to enrich discovered models from the public [models.dev](https://models.dev) metadata index.
Copy file name to clipboardExpand all lines: src/plugin/commands.ts
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,7 @@ Supported plugin options under provider.<id>.options.modelsDiscovery:
116
116
- smartModelName: use friendlier display names for discovered models
117
117
- modelInfoFormat="models.dev": enrich from the public models.dev index without modelInfoEndpoint
118
118
- modelInfoEndpoint plus modelInfoFormat="litellm": enrich from a LiteLLM-compatible model info endpoint
119
+
- modelInfoFormat="vllm": for vLLM-compatible providers whose raw /v1/models entries include a positive numeric max_model_len; without another request, sets limit.context and limit.output for matching discovered models
119
120
- filterNonChat: when LiteLLM model info is available, skip non-chat models by default
120
121
121
122
Recommended defaults:
@@ -135,6 +136,7 @@ Recommended defaults:
135
136
- use smartModelName=true only when the user wants friendlier display names
136
137
- use modelInfoFormat="models.dev" for models.dev metadata enrichment
137
138
- use modelInfoEndpoint and modelInfoFormat="litellm" for LiteLLM-compatible model info endpoints
139
+
- use modelInfoFormat="vllm" only when the provider's /v1/models response exposes max_model_len; it is not a standard OpenAI-compatible field, does not require modelInfoEndpoint, and does not infer other capabilities
138
140
139
141
Provider compatibility guidance:
140
142
- Discovery works for @ai-sdk/openai-compatible providers by default.
0 commit comments