发布

  • fix: read cache_write_tokens from OpenRouter API instead of hardcoding 0 (#9871)

    frostbyte_neo 发布于 2026-03-20 22:46:29 +00:00

    • fix: read cache_write_tokens from OpenRouter API instead of hardcoding 0
    • Read prompt_tokens_details.cache_write_tokens from OpenRouter stream usage
      chunks instead of hardcoding cacheWriteTokens to 0
    • Read native_tokens_cache_write from generation endpoint fallback
    • Replace fragile hardcoded model ID switch statement for cache_control blocks
      with prefix-based matching (anthropic/, minimax/) so new models automatically
      get prompt caching enabled
    • Add unit test verifying cache_write_tokens are correctly extracted

    Co-authored-by: Ara arafat.da.khan@gmail.com

    • fix: read cache_write_tokens from OpenRouter API instead of hardcoding 0
    • Read prompt_tokens_details.cache_write_tokens from OpenRouter stream usage
      chunks instead of hardcoding cacheWriteTokens to 0
    • Read native_tokens_cache_write from generation endpoint fallback
    • Replace fragile hardcoded model ID switch statement for cache_control blocks
      with prefix-based matching (anthropic/, minimax/) so new models automatically
      get prompt caching enabled
    • Add unit test verifying cache_write_tokens are correctly extracted

    Co-authored-by: Ara arafat.da.khan@gmail.com

    • Release v3.74.0 Notes

    • Release v3.74.0 Notes


    Co-authored-by: Cursor Agent cursoragent@cursor.com
    Co-authored-by: alex-lum alex@cline.bot

    下载附件