fix(ai-gateway): strip upstream cost for custom-priced models - #4853
Conversation
…itten responses isFreeModelRequiringCostRemoval now also covers models with custom pricing (gateway condition unchanged), since the upstream-reported cost does not reflect the custom pricing. Also make the rewrite functions' parameters required instead of optional/defaulted so call sites are explicit.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryNo new commits since the last review; the incremental diff since the previously reviewed commit remains a pure rename ( Files Reviewed (2 files)
Previous Review Summary (commit 13b364f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 13b364f)Status: No Issues Found | Recommendation: Merge Executive SummaryIncremental diff since the last review is a pure rename ( Files Reviewed (2 files)
Reviewed by claude-sonnet-5 · Input: 18 · Output: 5.7K · Cached: 384.1K Review guidance: REVIEW.md from base branch |
Summary
isFreeModelRequiringCostRemovalinrewriteModelResponseis now also true for models with custom pricing (getCustomPricing(model) !== undefined), in addition to Kilo-exclusive free models. The gateway condition (openrouter/vercel) still applies. The upstream-reported cost does not reflect Kilo's custom pricing, so it must be removed from the response just like for free models.rewriteModelResponse.ts(removeCost = true,capture?,vercelRequestId?on the three exported rewrite functions,capture?onreadResponseText/rewriteSseStream) are now required so call sites are explicit.Test plan
qwen/qwen3.7-plus); existing free-model/paid-model coverage unchanged.