Commit 0a5acb1
feat: add token usage tracking to OpenAI adapter (#7900)
* feat: add token usage tracking to OpenAI adapter
- Modified OpenAI adapter to properly handle and emit usage chunks in streaming responses
- Added logic to store usage chunks and emit them at the end of the stream
- Verified Anthropic and Gemini adapters already have complete token usage implementations
- Added comprehensive tests for token usage tracking across all three providers
- All tests passing with provided API keys
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: tests
---------
Co-authored-by: Claude <[email protected]>1 parent 4aa138f commit 0a5acb1
2 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
122 | 133 | | |
123 | 134 | | |
124 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
210 | 227 | | |
211 | 228 | | |
212 | 229 | | |
| |||
0 commit comments