Skip to content

Include ai_credits_this_response in AI credits usage JSONL parsing#38643

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/update-parser-ai-credits-helper
Closed

Include ai_credits_this_response in AI credits usage JSONL parsing#38643
Copilot wants to merge 1 commit into
mainfrom
copilot/update-parser-ai-credits-helper

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The AI Credits usage parser was only recognizing existing explicit credit fields and could miss consumption reported as ai_credits_this_response. This update extends explicit credit extraction so usage totals include that field as well.

  • Parser field precedence update

    • Extended explicit AI credit aliases in the JSONL helper to include:
      • ai_credits_this_response
      • aiCreditsThisResponse
    • Existing aliases (ai_credits, aiCredits, aic) remain supported.
  • Guardrail aggregation alignment

    • The daily guardrail path now correctly counts response-scoped AI credits when present in usage records, avoiding undercounted totals in mixed payload formats.
  • Targeted coverage update

    • Added a usage-record case with ai_credits_this_response and updated expected aggregate value accordingly.
const explicitAICredits = getNumericAliasField(usage, parsed, [
  "ai_credits_this_response",
  "aiCreditsThisResponse",
  "ai_credits",
  "aiCredits",
]);

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Update AI credits usage JSONL parser for ai_credits_this_response Include ai_credits_this_response in AI credits usage JSONL parsing Jun 11, 2026
Copilot AI requested a review from pelikhan June 11, 2026 16:07
@pelikhan pelikhan closed this Jun 11, 2026
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