Expose Claude Code context-scaling on /api/status (#163)#953
Open
seikixtc wants to merge 1 commit intojundot:mainfrom
Open
Expose Claude Code context-scaling on /api/status (#163)#953seikixtc wants to merge 1 commit intojundot:mainfrom
seikixtc wants to merge 1 commit intojundot:mainfrom
Conversation
Adds claude_code_context_scaling_enabled and claude_code_target_context_size to the existing /api/status endpoint, matching the flat naming convention used by the admin /api/stats response. Documents /api/status in the README so statusline integrations can discover it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #163.
The issue asked for an API endpoint that statuslines (Claude Code, custom prompts) can poll to render oMLX-specific stats — context limit, usage, cache efficiency. oMLX already ships a
GET /api/statusendpoint that covers most of this, but it's missing the Claude Code context-scaling fields and isn't documented in the README, so users don't know it exists.This PR closes the gap with a minimal change:
claude_code_context_scaling_enabledandclaude_code_target_context_sizeon/api/status, matching the flat naming already used by the admin/api/statsresponse./api/statusin the README under "API Compatibility", with a curl example and a representative response payload, so statusline integrations can discover it.No new endpoint, no new auth path, no schema break.
Files changed
omlx/server.py(/api/statusresponse)tests/test_status_endpoint.py(two new test cases)README.md(new "Status API" subsection)Test plan
pytest tests/test_status_endpoint.py -v— all existing cases plus two new ones:test_claude_code_fields_default_when_no_settings— verifies safe defaults (False,200000) whenglobal_settingsisNone.test_claude_code_fields_reflect_settings— verifies configured values flow through (True,131072).Sample response
{ "status": "ok", "version": "0.3.8", "uptime_seconds": 12834.2, "default_model": "Qwen3-Coder-Next-8bit", "loaded_models": ["Qwen3-Coder-Next-8bit"], "cache_efficiency": 87.5, "claude_code_context_scaling_enabled": true, "claude_code_target_context_size": 200000, "...": "..." }Notes for review
claude_code_context_scaling_enabled) rather than a nestedclaude_code: {...}block to stay consistent with/api/stats. Happy to switch to nested if you'd rather have a cleaner schema for external consumers — easy to flip.cache_efficiencyand the other already-exposed fields so a reader can see the full statusline payload in one place. If you'd prefer a minimal example that only highlights the new fields, let me know.