Skip to content

In BYOK, usage reports 1.0 (should not do) #514

@lucasns97

Description

@lucasns97

Summary

I'm using the Copilot SDK with BYOK (Anthropic provider) and receiving assistant.usage events with token usage data. The cost field appears to always be 1.0 regardless of actual token consumption, and I'd like clarification on what this field represents.

What I Observed

When monitoring assistant.usage events with claude-sonnet-4-5 via BYOK, the cost field consistently returns 1.0 regardless of token usage:

Test 1 - Short prompt (358 total tokens):

{
  type: "assistant.usage",
  data: {
    model: "claude-sonnet-4-5",
    inputTokens: 354,
    outputTokens: 4,
    cost: 1.0,  // Always 1.0
    duration: 1609
  }
}

Test 2 - Long prompt (813 total tokens):

{
  type: "assistant.usage",
  data: {
    model: "claude-sonnet-4-5",
    inputTokens: 382,
    outputTokens: 431,
    cost: 1.0,  // Still 1.0
    duration: 10110
  }
}

I also found issue #423 where gpt-5-mini shows cost: 0, suggesting the value varies by model.

Questions

  1. What does the cost field represent?

    • Is it the actual dollar cost of the API call?
    • Is it a count of "premium requests" consumed (in GitHub Copilot's quota system)?
    • Is it a normalized cost unit for internal tracking?
  2. For BYOK users calculating actual costs:

    • Should we rely on inputTokens and outputTokens for cost calculation?
    • Is the cost field meaningful when using BYOK, or does it only apply to standard GitHub Copilot authentication?
  3. Why does it vary by model?

Use Case

I'm building token usage tracking and cost analytics for multi-agent workflows using BYOK with Anthropic. Understanding what cost represents will help determine:

  • Whether to use it in our cost calculations
  • How to properly track expenses across different models
  • Whether to implement our own cost calculation based on token counts

Environment

  • SDK: Python (github-copilot-sdk)
  • Authentication: BYOK with Anthropic
  • Model: claude-sonnet-4-5
  • Copilot CLI version: 0.0.403

Additional Context

The assistant.usage event provides excellent token tracking data (inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, duration), which makes it very useful for usage analytics. Clarifying the cost field would complete the picture for developers building cost monitoring systems.


Question: What does the cost field represent?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions