mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1882] [Engine] serve: /v1/models also gives the context size as max_model_len and context_length #3734
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3734
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1882
Author: @LeGeRyChEeSe
Created: 10/10/2026
Status: 🔄 Open
Base:
main← Head:pr/models-context-len📝 Commits (1)
aae2852serve: /v1/models also gives the context size as max_model_len and context_length, the names vLLM and OpenRouter use📊 Changes
2 files changed (+5 additions, -1 deletions)
View changed files
📝
serve/server.py(+4 -1)📝
serve/test_server.py(+1 -0)📄 Description
Problem and result
/v1/modelsgives the context size only asmeta.n_ctx(llama-server's name). Clients that size their context window from the model list read other keys:max_model_len(vLLM's) orcontext_length(OpenRouter's). Without them they fall back to their own default, so they compact too early or send more than the server takes. v0.2.2 has neither key.After the change the same value (
svc.reported_ctx()) is under all three names.meta.n_ctxis unchanged.Related discussion
No open issue or pull request found (searched 2026-10-22:
max_model_len,context_length,/v1/models). #2618 (closed) adds more keys to the samemetadict; the two do not overlap.This pull request was closed in the 0.2.0-beta tracker reset; it is rebased on v0.2.4.1 and unchanged in content.
Approach
One line in the
/v1/modelshandler plus a comment: two more keys on the model entry (and on each alias entry, which copies it). Nothing is removed or renamed, so existing clients are unaffected.Validation
Revision:
main8183c6b6(v0.2.4.1) plus this one commit; the first runs were on v0.2.2 (011c9e60). Environment: Windows 11, Python 3.13, RTX 4070 SUPER.Passed:
main8183c6b6(v0.2.4.1):python -m unittest serve.test_serverpasses (353 tests, 3 skipped, Windows 11);test_model_discovery_and_propschecks the two new keys.test_responses.NoLeakedSampler.test_server_close_ends_the_sampler(1 != 2); it passes locally on this branch and the change touches no sampler code, so it looks like a flaky test, to be confirmed by the new CI run.grep -rn max_model_len serve/*.pyon v0.2.2: no match (the keys are absent before the change).python -m pytest serve -qon this branch: 912 passed, 17 skipped.test_model_discovery_and_propschecks the two new keys next tometa.n_ctx.GET /v1/modelsreturned"max_model_len": 131072and"context_length": 131072for both, with--max-context 131072.Failed:
none observed.
Not run:
Limits
Only the context size is added; other llama-server
metafacts are not part of this change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.