search: Brave Search behind /v1/search - #37
Merged
Merged
Conversation
The search family gets its HTTP surface (POST /v1/search {model, query,
count}) and its first real vendor: a `brave` provider account speaks the
Brave Search API (GET res/v1/web/search, X-Subscription-Token), the
vendor body passes through, and every search bills one unit at the
model's unit price. Live: 3 results through the gateway, one 5000-micro
ledger row.
… replay A `google`/`cse` provider speaks the Custom Search JSON API — the key on the query string, the engine id (cx) from secret_key_env, results at /items. Search models must pin a provider (same load-time rule as video: the wire is provider-specific) and the mock dispatches search by protocol, so the CSE path is e2e-covered. The search and video GETs now carry the account snapshot for replay, so a configured retry_status (Brave's 429) retries within the existing budget instead of failing; AccountPool::named hands out the Arc it already holds.
Verified live: every project answers 403 "does not have the access to Custom Search JSON API" regardless of enablement, quota, billing or key age; Google has closed the API to new customers (grandfathered projects keep access until 2027-01-01), so no reachable configuration exists. Brave stays as the search vendor; the status-replay fix on idempotent GETs stays.
CMGS
force-pushed
the
feat/brave-search
branch
from
August 19, 2026 17:52
5c2ca17 to
458bf5d
Compare
`vidu-video` looked like Vidu support; the fallback wire is invented and no real vendor speaks it. `demo-video` can't be misread as an integration; the TypedParams docs state the wired dialects instead of a vendor wish-list.
…ery params Brave signals its wait on x-ratelimit-reset (seconds until reset, comma list) when Retry-After is absent; the mock decodes q and honors count so the e2e exercises the wire the engine actually builds.
The bind-drop-dial sequence raced port reuse on shared runners (the dial landed on a stranger's 404); the address is now connect-checked refused before the transport dials it.
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.
What
POST /v1/search {model, query, count?}— the search family's first HTTP surface (the engine existed but had no route).braveprovider account speaks the Brave Search API:GET res/v1/web/searchwithX-Subscription-Token, the vendor body passes through, every search bills one unit at the model'sunit_price_micros. Any other provider keeps the generic shape.Protocol::Search.retry_status(e.g. Brave's 429) retries within the existing backoff/Retry-After budget instead of failing (Brave bills successful requests only).AccountPool::namedreturns theArcit already holds.Verification
cargo fmt --check/clippy -D warnings/cargo test --workspace: 542 passed / 0 failed; the e2e drives the mock Brave shape end to end (3 results,billed_units 1,cost_micros 5000).POST /v1/searchthrough the gateway → 3 web results, ledgerbilled_units 1, cost_micros 5000. The live-matrixsearchgroup is wired.