Skip to content

feat: enable usage API by default#13

Merged
Loongphy merged 3 commits intomainfrom
feat/default-enable-api
Mar 18, 2026
Merged

feat: enable usage API by default#13
Loongphy merged 3 commits intomainfrom
feat/default-enable-api

Conversation

@Loongphy
Copy link
Copy Markdown
Owner

@Loongphy Loongphy commented Mar 18, 2026

Summary

  • enable ChatGPT usage API refresh by default for new and defaulted registry config
  • show a warning in help, status, and list when usage is coming from the API
  • document that users can switch to local-only usage reading with codex-auth config api disable, which is safer but less accurate

Validation

  • zig test src/main.zig -lc
  • HOME=/tmp/codex-auth-home ZIG_GLOBAL_CACHE_DIR=/tmp/zig-cache zig build run -- list

Notes

  • default behavior now uses API-based usage queries unless the user explicitly disables it in config
  • existing users who already set api.usage = false keep that setting; list/help/status do not flip it back on

Note

Enable API-based usage refresh by default in registry.ApiConfig

  • Changes the default value of ApiConfig.usage in registry.zig from false to true, so new registries use API-only usage refresh out of the box.
  • Adds cli.writeUsageApiRiskWarning and cli.printUsageApiRiskWarning in cli.zig to emit a bold-yellow warning to stderr when API usage is enabled, with guidance to disable via codex-auth config api disable.
  • Wires the warning into help, status, and list commands in cli.zig, auto.zig, and main.zig respectively.
  • Behavioral Change: existing users upgrading will now default to API-only usage refresh; the warning appears on stderr for all three commands whenever API usage is enabled.

Macroscope summarized 9afafc3.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 18, 2026

Open in StackBlitz

@loongphy/codex-auth-darwin-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-arm64@13

@loongphy/codex-auth-darwin-x64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-x64@13

@loongphy/codex-auth-linux-x64

npx https://pkg.pr.new/@loongphy/codex-auth-linux-x64@13

@loongphy/codex-auth-win32-x64

npx https://pkg.pr.new/@loongphy/codex-auth-win32-x64@13

@loongphy/codex-auth

npx https://pkg.pr.new/@loongphy/codex-auth@13

commit: 9afafc3

@Loongphy Loongphy marked this pull request as ready for review March 18, 2026 11:47
@Loongphy Loongphy merged commit e888dec into main Mar 18, 2026
10 checks passed
@Loongphy Loongphy deleted the feat/default-enable-api branch March 18, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant