Repository navigation
Cloudflare Web Search dialect + live-matrix model refresh - #157
Merged
Merged
Conversation
The Brave key is gone, so the live matrix exercises web search through Cloudflare instead; the Brave dialect stays as it is.
qwen3-max -> qwen3.8-max, qwen3-235b-a22b -> qwen3.7-plus, qwen-turbo -> qwen-flash, ernie-x1.1 -> ernie-5.1; drop gemini-2.5-flash (closed to new users) and sora-2 (OpenAI removed the Videos API on 2026-09-24).
Clears RUSTSEC-2026-0346/0347/0348 and the fourth 0.23.45 advisory that fail cargo deny.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloudflaredialect toSearchEnginenext tobrave. Aprovider: cloudflareaccount posts{query, limit, options.gateway.id}to{endpoint}/ai/websearch/with the API token as Bearer, whereendpointishttps://api.cloudflare.com/client/v4/accounts/<account_id>and the gateway is the account'sdefault.countis capped at the vendor limit of 10, and the vendor body (items+metadata) passes through. One unit per query, the same as Brave. The Brave dialect is unchanged; it is only paused in the live matrix because there is no live key.qwen3-max→qwen3.8-max,qwen3-235b-a22b→qwen3.7-plus(Anthropic-compatible, thinking),qwen-turbo→qwen-flash(DashScope native wire),ernie-x1.1→ernie-5.1(reasoning).gemini-2.5-flash, which is closed to new users.sora-2video case: OpenAI removed the Videos API on 2026-09-24, and/v1/videosnow answers 404.Hot-path cost
Zero for non-search traffic. The new arm sits inside
SearchEngine::run, which is reached only forProtocol::Search. A Cloudflare search pays one small JSON body and one URLformat!, the same as the generic arm.Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --workspace: 739 passed, 0 failed, 4 ignored (env-gated suites).cloudflare_search_request_shapecovers the URL, body, limit cap and Bearer header.search_routes_each_dialect_and_bills_one_unitruns the end-to-end route and ledger for both Brave and Cloudflare.gw(release, this branch):search:cf-web-searchagainst the real Cloudflare API returned 3 results, and the ledger recorded 1 unit / 250 micros.qwen,qianfan,siliconflow,minimaxanddashscope-native: all pass with the new model names, includingernie-5.1reasoning in both buffered and stream mode.video: 4/4, covering Wan2.2 on SiliconFlow, wan2.2-t2v-plus, Hailuo-02 and Kling.ollama: 3/3.