Skip to content

feat: usage analytics, quota reset times, and zai balance support - #51

Merged
gui-drumond merged 7 commits into
mainfrom
codex/usage-analytics
Aug 13, 2026
Merged

feat: usage analytics, quota reset times, and zai balance support#51
gui-drumond merged 7 commits into
mainfrom
codex/usage-analytics

Conversation

@FabioRocha231

Copy link
Copy Markdown
Collaborator

What

  • Adds a cost-vs-speed analytics chart (Pareto frontier + request-volume bubbles) under a new Analytics tab. Labels strip the provider namespace and the same upstream model served through several gateways collapses into one bubble.
  • Shows quota reset times (normalized to ISO UTC) on the per-key dashboard.
  • Adds Z.AI (zai-coding) quota balance and models.dev catalog key support.
  • Splits provider keys/models into tabs.
  • Persists the local auth token across restarts so an open Codex keeps its credentials.
  • Records the actual upstream model in usage stats instead of the raw payload model.
  • Repairs tool-exchange items in sanitized stateless Responses payloads.

Commits

  • fix(proxy): persist local token across restarts
  • fix(proxy): record actual upstream model in usage stats
  • fix(translate): repair tool-exchange items in sanitized responses
  • feat(zai): quota balance, catalog key, and reset-time normalization
  • feat(ui): analytics chart, quota reset display, and provider/model tabs

Verification

  • bun run lint
  • bun run test
  • bun run build
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check
  • cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path src-tauri/Cargo.toml

@gui-drumond gui-drumond left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O objetivo faz sentido, mas há bloqueios funcionais:

  1. translate/request.rs conta calls no array inteiro, então um function_call_output anterior à call correspondente é preservado e a sequência continua inválida. A validação precisa respeitar a ordem e cobrir output-before-call.
  2. proxy.rs normaliza input vazio antes de remover outputs órfãos. Se o array só contém órfãos, o reparo deixa input: [] sem renormalizar.
  3. proxy/auth.rs busca a primeira ocorrência textual de x-loomrouter-token no config inteiro, podendo adotar comentário ou outro provider em vez do bloco gerenciado. Parseie/restrinja ao bloco LoomRouter.

Também corrija: Claude Code abre na aba Keys vazia, o texto resets não está no i18n, e a falha de write_private na migração do token é ignorada sem log.

@gui-drumond gui-drumond left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisão concluída após os fixes: tool exchange agora respeita ordem, input vazio é renormalizado, recuperação do token fica restrita ao bloco gerenciado, falhas de persistência são registradas, Claude Code abre diretamente em Models e reset de quota está internacionalizado. Branch atualizada com main. Gate local e CI remoto completos estão verdes.

@gui-drumond
gui-drumond merged commit 3d3b06a into main Aug 13, 2026
2 checks passed
@gui-drumond
gui-drumond deleted the codex/usage-analytics branch August 13, 2026 05:36
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.

2 participants