feat(api): advertise context_window on /v1/models from capabilities
This commit is contained in:
1 parent
041e039793
commit
2a1e192734
1 file changed
+4
@@ -485,6 +485,10 @@ export async function buildModelsList(kindFilter, options = {}) {
|
|||||||
|| capabilitiesFromServiceKind(customKind || liveKind)
|
|| capabilitiesFromServiceKind(customKind || liveKind)
|
||||||
|| (kind === LLM_KIND ? getCapabilitiesForModel(providerId, modelId) : null);
|
|| (kind === LLM_KIND ? getCapabilitiesForModel(providerId, modelId) : null);
|
||||||
if (caps) model.capabilities = caps;
|
if (caps) model.capabilities = caps;
|
||||||
|
// Advertise the context window for clients that read it from /v1/models
|
||||||
|
// (OpenAI-compatible convention; opencode's generic adapter ignores it
|
||||||
|
// and needs limit.context declared client-side).
|
||||||
|
if (caps?.contextWindow) model.context_window = caps.contextWindow;
|
||||||
models.push(model);
|
models.push(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user