fix(ai-gateway): avoid understating OpenRouter data collection - #5057
fix(ai-gateway): avoid understating OpenRouter data collection#5057chrarnoldus wants to merge 3 commits into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncrementally reviewed commit Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit fe9a7de)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit fe9a7de)Status: No Issues Found | Recommendation: Merge Executive SummaryIncrementally reviewed commit Files Reviewed (3 files)
Previous review (commit 600d33f)Status: No Issues Found | Recommendation: Merge Executive SummaryReviewed the worst-of provider data-policy merge for OpenRouter route variants: the OR-merge in Files Reviewed (3 files)
Reviewed by kimi-k3 · Input: 33.8K · Output: 4.7K · Cached: 176.1K Review guidance: REVIEW.md from base branch |
Problem
OpenRouter can offer the same model through multiple routes from one provider. For example, a provider may have both a standard route that retains prompts and a zero-data-retention (ZDR) route that does not.
The model-list API returns only one of those routes for each model. When it returns the ZDR route, our provider sync stores
retainsPrompts: falseeven though requests can also use the provider's data-retaining route. Which policy appears in our UI can therefore change based on the route selected by OpenRouter.Fix
When building the provider snapshot, combine the selected model route's policy with the provider-wide policy:
This does not group providers by name or slug prefix. Each model is combined only with the provider whose OpenRouter-filtered model response contained it. The transformation returns a new model instead of modifying OpenRouter's parsed response.
Live example
OpenRouter currently exposes
x-ai/grok-4.5through bothxaiandxai/zdrroutes. The model-list response selectedSpaceXAI (ZDR)withretainsPrompts: false, while the xAI provider-wide policy reportsretainsPrompts: true. After this change, Kilo reports that the model may retain prompts.Verification
pnpm --filter web typecheckpnpm --filter web lintgit diff --check