anthropics / anthropics/claude-code
Status line rate_limits should include the model-specific weekly window shown in /usage
- Ngôn ngữ chính
- Python
- Star
- 145k
- Fork
- 23.1k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
**Summary**
The status line JSON exposes `rate_limits.five_hour` and `rate_limits.seven_day` (and `spend_limit`
behind a gateway). `/usage` additionally shows a third bar, "Current week ()", for the
model-specific weekly limit. That window is not available to status line scripts, so external
dashboards built on the documented status line contract cannot show it.
**Observed (Claude Code 2.1.252, claude.ai Team plan)**
`/usage` shows three bars: 5-hour 21 %, weekly all models 23 %, weekly Fable 42 %.
The status line JSON for the same session carries only:
```json
"rate_limits": {
"five_hour": { "used_percentage": 20, "resets_at": 1788483600 },
"seven_day": { "used_percentage": 22, "resets_at": 1788624000 }
}
```
**Expected**
A third entry for the model-scoped window, in the same shape, for example:
```json
"seven_day_model": { "model": "Fable", "used_percentage": 42, "resets_at": 1788624000 }
```
or one entry per scoped model (`seven_day_opus`, `seven_day_sonnet`, …), matching the labels the CLI
already uses ("Opus limit", "Sonnet limit", "Fable limit").
**Why it matters**
The status line is the one documented, first-party way to observe plan usage from outside Claude Code.
Tools that respect that contract can show session and all-models usage, but the model-specific window
is often the one that runs out first, so it is the one users most want to see. Without it, tool authors
are pushed towards undocumented endpoints.
**Notes**
- The CLI's internal rate-limit state already parses the scoped window (`seven_day_overage_included` in
the usage response, labelled "Fable limit"); the status line builder simply does not include it.
- Behaviour when the window is absent (plans without a scoped limit) could mirror the existing rule:
omit the key.
- Related: the `/usage` panel fetches `/api/oauth/usage`, which includes the scoped windows; a
documented read-only endpoint for subscription usage would serve the same need more broadly.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Locate the status line builder and the internal rate-limit state that parses seven_day_overage_included from the usage response. Compare that data with the existing five_hour and seven_day status line entries, then verify the JSON exposes the model-scoped window when present and omits it when absent, matching the /usage labels and percentages.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api, cli
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100