codex-cli-usage 0.1.10__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ __pycache__/
2
+ .venv/
3
+ dist/
4
+ dist-wrappers/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mihai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.5
2
+ Name: codex-cli-usage
3
+ Version: 0.4.1
4
+ Summary: Codex rate limit monitor
5
+ Project-URL: Homepage, https://github.com/wakamex/clanker-usage
6
+ Project-URL: Source, https://github.com/wakamex/clanker-usage
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: chatgpt,cli,codex,openai,rate-limits,statusline,usage
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: clanker-usage==0.4.1
12
+ Description-Content-Type: text/markdown
13
+
14
+ # codex-cli-usage
15
+
16
+ Monitor your Codex quota from the terminal: current usage, a one-line statusline, and a daemon that keeps a cache fresh.
17
+
18
+ ```sh
19
+ uv tool install codex-cli-usage
20
+ codex-cli-usage # current quotas
21
+ codex-cli-usage statusline # one line, from a cache less than five minutes old
22
+ codex-cli-usage json # the usage-v1 document
23
+ ```
24
+
25
+ `codex-cli-usage` is the Codex command of [clanker-usage](https://github.com/wakamex/clanker-usage), so it installs clanker-usage at the same version. The documentation lives there.
@@ -0,0 +1,12 @@
1
+ # codex-cli-usage
2
+
3
+ Monitor your Codex quota from the terminal: current usage, a one-line statusline, and a daemon that keeps a cache fresh.
4
+
5
+ ```sh
6
+ uv tool install codex-cli-usage
7
+ codex-cli-usage # current quotas
8
+ codex-cli-usage statusline # one line, from a cache less than five minutes old
9
+ codex-cli-usage json # the usage-v1 document
10
+ ```
11
+
12
+ `codex-cli-usage` is the Codex command of [clanker-usage](https://github.com/wakamex/clanker-usage), so it installs clanker-usage at the same version. The documentation lives there.
@@ -0,0 +1,7 @@
1
+ """codex-cli-usage: the Codex command of clanker-usage."""
2
+
3
+ from clanker_usage import run
4
+
5
+
6
+ def main():
7
+ return run("codex")
@@ -0,0 +1,3 @@
1
+ from . import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["hatchling==1.32.4"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "codex-cli-usage"
7
+ version = "0.4.1"
8
+ description = "Codex rate limit monitor"
9
+ readme = "README.md"
10
+ keywords = ["codex", "openai", "chatgpt", "usage", "rate-limits", "statusline", "cli"]
11
+ requires-python = ">=3.12"
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+ dependencies = ["clanker-usage==0.4.1"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/wakamex/clanker-usage"
18
+ Source = "https://github.com/wakamex/clanker-usage"
19
+
20
+ [project.scripts]
21
+ codex-cli-usage = "codex_cli_usage:main"
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["codex_cli_usage"]
@@ -1,29 +0,0 @@
1
- name: Publish to PyPI
2
-
3
- on:
4
- push:
5
- tags:
6
- - "v*"
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
- environment: pypi
12
- permissions:
13
- contents: read
14
- id-token: write
15
- steps:
16
- - name: Checkout
17
- uses: actions/checkout@v7.0.1
18
- - name: Install uv
19
- uses: astral-sh/setup-uv@v9.0.0
20
- with:
21
- enable-cache: false
22
- - name: Verify version tag
23
- run: test "$GITHUB_REF_NAME" = "v$(uv --no-config version --short)"
24
- - name: Test
25
- run: uv --no-config run --locked python -m unittest discover -s tests
26
- - name: Build
27
- run: uv --no-config build --no-sources
28
- - name: Publish
29
- run: uv publish --trusted-publishing always
@@ -1,2 +0,0 @@
1
- __pycache__/
2
- *.pyc
@@ -1,116 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: codex-cli-usage
3
- Version: 0.1.10
4
- Summary: Codex CLI usage monitor — fetches rate limits through the Codex app-server
5
- Project-URL: Homepage, https://github.com/wakamex/codex-cli-usage
6
- Project-URL: Source, https://github.com/wakamex/codex-cli-usage
7
- Requires-Python: >=3.12
8
- Description-Content-Type: text/markdown
9
-
10
- # codex-cli-usage
11
-
12
- Codex CLI usage monitor. Fetches your rate limit data through Codex and displays it in the terminal.
13
-
14
- ## Example output
15
-
16
- `codex-cli-usage` command:
17
-
18
- ```
19
- Plan: plus
20
- Weekly 39% resets 143h26m
21
- ```
22
-
23
- Codex statusline (self-caching — refreshes from API when stale, no daemon needed):
24
-
25
- ```
26
- weekly:39% plus reset:143h26m
27
- ```
28
-
29
- ## Install
30
-
31
- ```bash
32
- uv tool install codex-cli-usage
33
- ```
34
-
35
- Then run:
36
-
37
- ```bash
38
- # Check usage once
39
- codex-cli-usage
40
-
41
- # Run the daemon (keeps usage-limits.json updated)
42
- codex-cli-usage daemon
43
- ```
44
-
45
- ## Commands
46
-
47
- | Command | Description |
48
- |---------|-------------|
49
- | `codex-cli-usage` | Show current usage (colored terminal output) |
50
- | `codex-cli-usage json` | Print raw JSON |
51
- | `codex-cli-usage daemon [-i SECS]` | Run in foreground, refresh every 5 min (customizable) |
52
- | `codex-cli-usage statusline` | Compact statusline (self-caching, no daemon needed) |
53
- | `codex-cli-usage install` | Print setup instructions |
54
-
55
- ## How Codex CLI rate limiting works
56
-
57
- Discovered by inspecting the Codex CLI and its authentication flow.
58
-
59
- ### Data sources
60
-
61
- codex-cli-usage gets rate limit data from:
62
-
63
- 1. **`codex app-server --stdio`** — Preferred. Codex owns authentication and returns rate limits through `account/rateLimits/read`.
64
- 2. **`/backend-api/codex/usage` endpoint** — Compatibility fallback when Codex is missing or its app-server does not support the rate-limit method.
65
-
66
- ### Rate limit types
67
-
68
- | Type | Description |
69
- |------|-------------|
70
- | `primary_window` | Primary window; duration comes from `limit_window_seconds` |
71
- | `secondary_window` | Secondary window; duration comes from `limit_window_seconds` |
72
- | `additional_rate_limits` | Per-model limits (e.g. specific model caps) |
73
- | `code_review_rate_limit` | Code review usage limit |
74
-
75
- Window names are derived from `limit_window_seconds`, not from whether the
76
- backend calls a window primary or secondary. Approximately 5-hour, daily,
77
- weekly, monthly, and annual windows receive duration labels. Other or missing
78
- durations are shown as `Primary` or `Secondary`. Additional per-model limits
79
- remain available in JSON for compatibility but are not shown in normal output.
80
-
81
- ### Cache format
82
-
83
- Schema version 2 stores aggregate windows by their backend role while retaining
84
- their actual duration:
85
-
86
- ```json
87
- {
88
- "schema_version": 2,
89
- "primary": {
90
- "pct": 39,
91
- "resets_at": "2026-07-18T20:00:00+00:00",
92
- "window_secs": 604800
93
- }
94
- }
95
- ```
96
-
97
- Legacy `5h` and `7d` aliases are written only when the corresponding aggregate
98
- window actually classifies as 5-hour or weekly. Readers should prefer
99
- `primary` and `secondary`.
100
-
101
- ### Authentication
102
-
103
- The OAuth tokens live at `~/.codex/auth.json` by default and are written by the
104
- Codex CLI on login. When `CODEX_HOME` is set, the direct compatibility fallback
105
- reads `$CODEX_HOME/auth.json`. The preferred app-server path leaves credential
106
- resolution to Codex.
107
-
108
- Codex owns automatic token refresh and credential persistence. The compatibility
109
- fallback reads `auth.json` but never modifies credentials.
110
-
111
- ### Local files
112
-
113
- | File | Written by | Contains |
114
- |------|-----------|----------|
115
- | `~/.codex/auth.json` | Codex CLI | OAuth tokens (access, refresh, id_token) |
116
- | `~/.codex/usage-limits.json` | codex-cli-usage daemon | Cached API usage data (this tool) |
@@ -1,107 +0,0 @@
1
- # codex-cli-usage
2
-
3
- Codex CLI usage monitor. Fetches your rate limit data through Codex and displays it in the terminal.
4
-
5
- ## Example output
6
-
7
- `codex-cli-usage` command:
8
-
9
- ```
10
- Plan: plus
11
- Weekly 39% resets 143h26m
12
- ```
13
-
14
- Codex statusline (self-caching — refreshes from API when stale, no daemon needed):
15
-
16
- ```
17
- weekly:39% plus reset:143h26m
18
- ```
19
-
20
- ## Install
21
-
22
- ```bash
23
- uv tool install codex-cli-usage
24
- ```
25
-
26
- Then run:
27
-
28
- ```bash
29
- # Check usage once
30
- codex-cli-usage
31
-
32
- # Run the daemon (keeps usage-limits.json updated)
33
- codex-cli-usage daemon
34
- ```
35
-
36
- ## Commands
37
-
38
- | Command | Description |
39
- |---------|-------------|
40
- | `codex-cli-usage` | Show current usage (colored terminal output) |
41
- | `codex-cli-usage json` | Print raw JSON |
42
- | `codex-cli-usage daemon [-i SECS]` | Run in foreground, refresh every 5 min (customizable) |
43
- | `codex-cli-usage statusline` | Compact statusline (self-caching, no daemon needed) |
44
- | `codex-cli-usage install` | Print setup instructions |
45
-
46
- ## How Codex CLI rate limiting works
47
-
48
- Discovered by inspecting the Codex CLI and its authentication flow.
49
-
50
- ### Data sources
51
-
52
- codex-cli-usage gets rate limit data from:
53
-
54
- 1. **`codex app-server --stdio`** — Preferred. Codex owns authentication and returns rate limits through `account/rateLimits/read`.
55
- 2. **`/backend-api/codex/usage` endpoint** — Compatibility fallback when Codex is missing or its app-server does not support the rate-limit method.
56
-
57
- ### Rate limit types
58
-
59
- | Type | Description |
60
- |------|-------------|
61
- | `primary_window` | Primary window; duration comes from `limit_window_seconds` |
62
- | `secondary_window` | Secondary window; duration comes from `limit_window_seconds` |
63
- | `additional_rate_limits` | Per-model limits (e.g. specific model caps) |
64
- | `code_review_rate_limit` | Code review usage limit |
65
-
66
- Window names are derived from `limit_window_seconds`, not from whether the
67
- backend calls a window primary or secondary. Approximately 5-hour, daily,
68
- weekly, monthly, and annual windows receive duration labels. Other or missing
69
- durations are shown as `Primary` or `Secondary`. Additional per-model limits
70
- remain available in JSON for compatibility but are not shown in normal output.
71
-
72
- ### Cache format
73
-
74
- Schema version 2 stores aggregate windows by their backend role while retaining
75
- their actual duration:
76
-
77
- ```json
78
- {
79
- "schema_version": 2,
80
- "primary": {
81
- "pct": 39,
82
- "resets_at": "2026-07-18T20:00:00+00:00",
83
- "window_secs": 604800
84
- }
85
- }
86
- ```
87
-
88
- Legacy `5h` and `7d` aliases are written only when the corresponding aggregate
89
- window actually classifies as 5-hour or weekly. Readers should prefer
90
- `primary` and `secondary`.
91
-
92
- ### Authentication
93
-
94
- The OAuth tokens live at `~/.codex/auth.json` by default and are written by the
95
- Codex CLI on login. When `CODEX_HOME` is set, the direct compatibility fallback
96
- reads `$CODEX_HOME/auth.json`. The preferred app-server path leaves credential
97
- resolution to Codex.
98
-
99
- Codex owns automatic token refresh and credential persistence. The compatibility
100
- fallback reads `auth.json` but never modifies credentials.
101
-
102
- ### Local files
103
-
104
- | File | Written by | Contains |
105
- |------|-----------|----------|
106
- | `~/.codex/auth.json` | Codex CLI | OAuth tokens (access, refresh, id_token) |
107
- | `~/.codex/usage-limits.json` | codex-cli-usage daemon | Cached API usage data (this tool) |
@@ -1,24 +0,0 @@
1
- [project]
2
- name = "codex-cli-usage"
3
- version = "0.1.10"
4
- description = "Codex CLI usage monitor — fetches rate limits through the Codex app-server"
5
- readme = "README.md"
6
- requires-python = ">=3.12"
7
- dependencies = []
8
-
9
- [tool.uv]
10
- package = true
11
-
12
- [build-system]
13
- requires = ["hatchling"]
14
- build-backend = "hatchling.build"
15
-
16
- [tool.hatch.build.targets.wheel]
17
- packages = ["src/codex_cli_usage"]
18
-
19
- [project.urls]
20
- Homepage = "https://github.com/wakamex/codex-cli-usage"
21
- Source = "https://github.com/wakamex/codex-cli-usage"
22
-
23
- [project.scripts]
24
- codex-cli-usage = "codex_cli_usage:main"