mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-29 12:00:19 +01:00
7fab4c0527
## Summary OpenRouter aliases are prefixed with `~` (e.g. `~anthropic/claude-sonnet-latest`). `into_open_router` only checked for the `anthropic/` prefix, so aliases were not treated as Anthropic models: no `cache_control` was sent (no prompt caching), and `reasoning_details` was echoed back in requests. Strip the leading `~` before checking the prefix. Aliases are documented at https://openrouter.ai/docs/guides/routing/routers/latest-resolution ## Testing Added `test_anthropic_alias_model_uses_anthropic_request_handling`. It fails without the fix (`Alias should get cache_control`) and passes with it. `cargo test -p language_models --lib open_router`, `cargo fmt --check` and `./script/clippy -p language_models` pass. I did not test this manually against the OpenRouter API. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the checklist. (N/A, no UI change) - [x] Tests cover the new or changed behavior. Release Notes: - Fixed prompt caching for OpenRouter Anthropic aliases (e.g. `~anthropic/...`)