docs(credits): web search 5→1 credit + auto top-up opt-out contract
Merged
SW
5mo ago+241+241+012345678901234567890123456789-3-3-0123456789
Summary
- Reprices
POST /api/research/webfrom 5 credits to 1 credit per call in the billed-endpoints table (provider cost is $0.005/request flat; the 5-credit fee overpriced generic web search ~10x). - Documents the new auto top-up opt-out:
GET+PATCH /api/accounts/{id}/auto-recharge(OpenAPI blocks, two frontmatter-only reference pages, Billing nav entries), plus an Opting out section incredits.mdxand the opted-out branch in the auto top-up decision tree.
Contract highlights
enabled: trueis the default for every account; the setting lives on the account's Stripe customer record and is read live.- Opting out never removes the saved card — manual checkout top-ups keep working; re-enabling requires no card re-entry.
- While opted out, billed requests that exceed the balance return the existing 402 +
checkoutUrlshape — no new error envelope.
Merge order
This is the contract PR for recoupable/chat#1861: docs (this) → api → chat. The api PR implements exactly this spec.
OpenAPI diff is purely additive (206 insertions, 0 deletions); both docs.json and accounts.json re-validated as parseable.
🤖 Generated with Claude Code
Summary by cubic
Repriced POST /api/research/web from 5 to 1 credit and added an auto top-up opt-out API so accounts can disable off-session charges without removing their saved card.
-
New Features
- Auto top-up opt-out:
GET/PATCH /api/accounts/{id}/auto-recharge(defaultenabled: true, stored on the account’s Stripe customer). Whenenabled: false, requests that exceed balance return 402 withcheckoutUrl(nodeclineReason), and the saved card is never charged off-session. No new error shape. Docs add new reference pages, nav entries, an “Opting out” section, and a decision tree update. - Web search repricing:
POST /api/research/webnow costs 1 credit per call. Billed-endpoints table updated.
- Auto top-up opt-out:
-
Bug Fixes
- Updated the opt-out curl example to use
$ACCOUNT_ID.
- Updated the opt-out curl example to use
Summary by CodeRabbit
-
New Features
- Added API reference docs for viewing and updating an account’s auto top-up setting.
- Expanded billing documentation to explain opt-out behavior, 402 responses, and how the setting persists across card changes.
-
Bug Fixes
- Clarified that auto top-up will not trigger when an account has opted out.
- Updated the listed credit cost for the web research endpoint.
-
Documentation
- Added the new auto top-up pages to the Accounts billing documentation navigation.