mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
* fix: add cache reporting support for OpenAI-Native provider - Add normalizeUsage method to properly extract cache tokens from Responses API - Support both detailed token shapes (input_tokens_details) and legacy fields - Calculate cache read/write tokens with proper fallbacks - Include reasoning tokens when available in output_tokens_details - Ensure accurate cost calculation using uncached input tokens This fixes the issue where caching information was not being reported when using the OpenAI-Native provider with the Responses API. * fix: improve cache token normalization and add comprehensive tests - Add fallback to derive total input tokens from details when totals are missing - Remove unused convertToOpenAiMessages import - Add comment explaining cost calculation alignment with Gemini provider - Add comprehensive test coverage for normalizeUsage method covering: - Detailed token shapes with cached/miss tokens - Legacy field names and SSE-only events - Edge cases including missing totals with details-only - Cost calculation with uncached input tokens * fix: address PR review comments - Remove incorrect fallback to missFromDetails for cache write tokens - Fix cost calculation to pass total input tokens (calculateApiCostOpenAI handles subtraction) - Improve readability by extracting cache detail checks to intermediate variables - Remove redundant ?? undefined - Update tests to reflect correct behavior (miss tokens are not cache writes) - Add clarifying comments about cache miss vs cache write tokens |
||
|---|---|---|
| .. | ||
| __mocks__ | ||
| __tests__ | ||
| activate | ||
| api | ||
| assets | ||
| core | ||
| extension | ||
| i18n | ||
| integrations | ||
| services | ||
| shared | ||
| utils | ||
| workers | ||
| .gitignore | ||
| .prettierignore | ||
| .vscodeignore | ||
| esbuild.mjs | ||
| eslint.config.mjs | ||
| extension.ts | ||
| package.json | ||
| package.nls.ca.json | ||
| package.nls.de.json | ||
| package.nls.es.json | ||
| package.nls.fr.json | ||
| package.nls.hi.json | ||
| package.nls.id.json | ||
| package.nls.it.json | ||
| package.nls.ja.json | ||
| package.nls.json | ||
| package.nls.ko.json | ||
| package.nls.nl.json | ||
| package.nls.pl.json | ||
| package.nls.pt-BR.json | ||
| package.nls.ru.json | ||
| package.nls.tr.json | ||
| package.nls.vi.json | ||
| package.nls.zh-CN.json | ||
| package.nls.zh-TW.json | ||
| tsconfig.json | ||
| turbo.json | ||
| vitest.config.ts | ||
| vitest.setup.ts | ||