mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +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 |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| fetchers | ||
| utils | ||
| anthropic-vertex.ts | ||
| anthropic.ts | ||
| base-openai-compatible-provider.ts | ||
| base-provider.ts | ||
| bedrock.ts | ||
| cerebras.ts | ||
| chutes.ts | ||
| claude-code.ts | ||
| constants.ts | ||
| deepseek.ts | ||
| doubao.ts | ||
| fake-ai.ts | ||
| featherless.ts | ||
| fireworks.ts | ||
| gemini.ts | ||
| glama.ts | ||
| groq.ts | ||
| huggingface.ts | ||
| human-relay.ts | ||
| index.ts | ||
| io-intelligence.ts | ||
| lite-llm.ts | ||
| lm-studio.ts | ||
| mistral.ts | ||
| moonshot.ts | ||
| native-ollama.ts | ||
| ollama.ts | ||
| openai-native.ts | ||
| openai.ts | ||
| openrouter.ts | ||
| qwen-code.ts | ||
| requesty.ts | ||
| roo.ts | ||
| router-provider.ts | ||
| sambanova.ts | ||
| unbound.ts | ||
| vercel-ai-gateway.ts | ||
| vertex.ts | ||
| vscode-lm.ts | ||
| xai.ts | ||
| zai.ts | ||