Skip to content

Conversation

@appleboy
Copy link
Owner

  • Add token usage metrics (prompt_tokens, completion_tokens, total_tokens) to action outputs and documentation
  • Output additional details if available, such as cached prompt tokens, reasoning tokens, accepted/rejected prediction tokens
  • Update action to print detailed token usage information in the logs

- Add token usage metrics (prompt_tokens, completion_tokens, total_tokens) to action outputs and documentation
- Output additional details if available, such as cached prompt tokens, reasoning tokens, accepted/rejected prediction tokens
- Update action to print detailed token usage information in the logs

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Copilot AI review requested due to automatic review settings December 20, 2025 03:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive token usage metrics to the GitHub Action's outputs and logs, enabling users to track and monitor token consumption for cost optimization and usage analysis.

Key Changes:

  • Add core token usage metrics (prompt_tokens, completion_tokens, total_tokens) to action outputs
  • Include optional detailed metrics (cached tokens, reasoning tokens, accepted/rejected prediction tokens) when available from the API
  • Add formatted token usage information to action logs for visibility during execution

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
main.go Implements token usage logging and adds token metrics to GitHub Actions outputs with proper nil checks for optional fields
action.yml Defines new output parameters for token usage metrics with clear descriptions
README.md Documents the new token usage output parameters with explanations of when optional fields are available
README.zh-CN.md Chinese (Simplified) translation of the token usage output documentation
README.zh-TW.md Chinese (Traditional) translation of the token usage output documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@appleboy appleboy merged commit 680f41b into main Dec 20, 2025
9 checks passed
@appleboy appleboy deleted the output branch December 20, 2025 03:27
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