Skip to content

search: Brave Search behind /v1/search - #37

Merged
CMGS merged 7 commits into
mainfrom
feat/brave-search
Aug 19, 2026
Merged

search: Brave Search behind /v1/search#37
CMGS merged 7 commits into
mainfrom
feat/brave-search

Conversation

@CMGS

@CMGS CMGS commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

What

  • POST /v1/search {model, query, count?} — the search family's first HTTP surface (the engine existed but had no route).
  • A brave provider account speaks the Brave Search API: GET res/v1/web/search with X-Subscription-Token, the vendor body passes through, every search bills one unit at the model's unit_price_micros. Any other provider keeps the generic shape.
  • Search models must pin a provider (same load-time rule as video — the wire is provider-specific), and the mock transport dispatches search by Protocol::Search.
  • The search and video idempotent GETs carry the account snapshot for status replay: a configured retry_status (e.g. Brave's 429) retries within the existing backoff/Retry-After budget instead of failing (Brave bills successful requests only). AccountPool::named returns the Arc it already holds.
  • Google Custom Search JSON API is deliberately not wired: live probing established that Google has closed it to new customers — every project answers 403 "does not have the access" regardless of enablement, quota, billing or key age (grandfathered projects keep access until 2027-01-01). The docs record this so it isn't re-attempted.

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).
  • Live (real Brave key, free tier): POST /v1/search through the gateway → 3 web results, ledger billed_units 1, cost_micros 5000. The live-matrix search group is wired.
  • Rebased onto main after video: Kling text2video dialect #36 (conflicts in live.yaml/providers.md/harness resolved keeping both sides).

CMGS added 4 commits August 20, 2026 01:32
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
CMGS force-pushed the feat/brave-search branch from 5c2ca17 to 458bf5d Compare August 19, 2026 17:52
CMGS added 3 commits August 20, 2026 02:28
`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.
@CMGS
CMGS merged commit b545e5e into main Aug 19, 2026
2 checks passed
@CMGS
CMGS deleted the feat/brave-search branch August 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant