Skip to content

Feature request: expose per-run cost and token usage as Action outputs #1482

Description

@hudaif-eg

Context

We're evaluating Claude Code cost across models in GitHub Actions. After inspecting the Action source and testing the released anthropics/claude-code-action@v1, we couldn't find a supported way to retrieve per-run usage metrics.

Our investigation found

  • The Action completes successfully but does not expose cost/token metrics as outputs.
  • The Claude CLI is not available after the Action, so /usage and /cost cannot be called in later workflow steps.
  • show_full_output: true did not emit usage information in our logs.

Ask

Is there a supported way to retrieve per-run metrics such as:

  • Total cost (USD)
  • Input/output tokens
  • Cache read/write tokens

If not, would you consider exposing these as official Action outputs if the underlying SDK provides them?

Proposed output names (for discussion):

total_cost_usd
input_tokens
output_tokens
cache_read_tokens
cache_write_tokens

This would be valuable for teams monitoring API spend per PR review run without needing to correlate against the Anthropic Console manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestp3Minor bug or general feature request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions