codex-cli-usage 0.1.6__tar.gz → 0.1.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codex-cli-usage
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Codex CLI usage monitor — fetches rate limits from OpenAI's ChatGPT backend API
5
5
  Project-URL: Homepage, https://github.com/wakamex/codex-cli-usage
6
6
  Project-URL: Source, https://github.com/wakamex/codex-cli-usage
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codex-cli-usage"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  description = "Codex CLI usage monitor — fetches rate limits from OpenAI's ChatGPT backend API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -166,7 +166,7 @@ def fetch_usage() -> dict:
166
166
  def build_usage_json(api_data: dict) -> dict:
167
167
  """Transform API response into our cached format."""
168
168
  plan = api_data.get("plan_type", "unknown")
169
- rl = api_data.get("rate_limit", {})
169
+ rl = api_data.get("rate_limit") or {}
170
170
 
171
171
  result = {
172
172
  "plan": plan,
@@ -191,12 +191,12 @@ def build_usage_json(api_data: dict) -> dict:
191
191
  }
192
192
 
193
193
  # Additional rate limits (e.g. per-model limits)
194
- additional = api_data.get("additional_rate_limits", [])
194
+ additional = api_data.get("additional_rate_limits") or []
195
195
  if additional:
196
196
  result["additional"] = []
197
197
  for item in additional:
198
198
  name = item.get("limit_name", "")
199
- sub_rl = item.get("rate_limit", {})
199
+ sub_rl = item.get("rate_limit") or {}
200
200
  entry = {"name": name}
201
201
  p = sub_rl.get("primary_window")
202
202
  if p:
@@ -213,7 +213,7 @@ def build_usage_json(api_data: dict) -> dict:
213
213
  result["additional"].append(entry)
214
214
 
215
215
  # Code review limits
216
- cr = api_data.get("code_review_rate_limit", {})
216
+ cr = api_data.get("code_review_rate_limit") or {}
217
217
  cr_primary = cr.get("primary_window")
218
218
  if cr_primary and cr_primary.get("used_percent", 0) > 0:
219
219
  result["code_review"] = {
@@ -222,7 +222,7 @@ def build_usage_json(api_data: dict) -> dict:
222
222
  }
223
223
 
224
224
  # Credits
225
- credits = api_data.get("credits", {})
225
+ credits = api_data.get("credits") or {}
226
226
  if credits and credits.get("has_credits"):
227
227
  result["credits"] = credits
228
228
 
File without changes