refactor(openai): Split token counting by API for easier deprecation#5930
Merged
ericapisani merged 10 commits intoApr 2, 2026
@sentry/warden / warden
completed
Apr 2, 2026 in 3m 48s
1 issue
Medium
Missing manual output token counting for non-streaming Responses API - `sentry_sdk/integrations/openai.py:291-295`
_calculate_responses_token_usage only manually counts output tokens when streaming_message_responses is provided (lines 292-295). Unlike _calculate_completions_token_usage which falls back to counting from response.choices (lines 220-223), this function lacks equivalent logic to extract and count tokens from response.output. For non-streaming Responses API calls that don't include usage data, output tokens will remain 0.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 1m 59s | $1.30 |
| find-bugs | 0 | 3m 43s | $2.74 |
| skill-scanner | 0 | 1m 3s | $0.28 |
| security-review | 0 | 2m 40s | $0.35 |
Duration: 9m 24s · Tokens: 3.7M in / 35.1k out · Cost: $4.68 (+extraction: $0.00, +dedup: $0.00)
Loading