-
Notifications
You must be signed in to change notification settings - Fork 877
Description
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
-
What does the
costfield 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?
-
For BYOK users calculating actual costs:
- Should we rely on
inputTokensandoutputTokensfor cost calculation? - Is the
costfield meaningful when using BYOK, or does it only apply to standard GitHub Copilot authentication?
- Should we rely on
-
Why does it vary by model?
claude-sonnet-4-5:cost: 1.0gpt-5-mini:cost: 0(per issue gpt-5-mini not being recognized as valid model argument even though it works when set to default model in CLI #423)
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?