Instruction builders
Instruction builders
| Task | Protocol methods |
|---|---|
| Market and users | initialize_market, initialize_user, deposit, withdraw. |
| Providers and models | initialize_provider, update_provider_metadata, initialize_model, update_model_metadata. |
| Shared limits | initialize_provider_limit_page, grow_provider_limit_page, initialize_provider_limits, configure_provider_limits. |
| List routing | initialize_list_routing, grow_list_routing, update_routing_list, enable_policy_mirror, freeze_policy_mirror. |
| Offers | initialize_list_books, grow_list_books, set_provider_list_offer, prune_provider_list_offer. |
| Wallet counters | initialize_provider_wallet, grow_provider_wallet, prune_provider_wallet, close_provider_wallet. |
| Bookings | initialize_reusable_booking, book_with_provider_limits, claim, release, expire, close. |
ProviderLimits { global, wallet } holds concurrency, quota, and window duration for both scopes. Each provider has one stable index into a canonical counter page. Every model and list uses the same row.
BookRequest contains rates, token bounds, checkpoint, modalities, estimates, list, cache provider, spend cap, and optional minimum_wallet_capacity. This retained name means minimum advertised global and wallet concurrency in shared mode. Omission means 1. Each booking uses one slot.
Read Market.provider_limits_enabled. required_pages identifies canonical pages for the complete list/model book. Supply those pages to book_with_provider_limits; the winner’s page must be writable. select_provider_limits previews selection, but the program matches current state again. Missing state that could change the winner causes rejection.
Use SettlementKeys::from_booking for claims, release, and expiry. It preserves the booked provider counters, payout, fee destinations, and settlement format. Current offers do not replace those bindings.
BookingMode::Reusable supplies the next generation. Initialize storage before reservation, either earlier or in the same transaction. OneShot uses generation zero. Older routing modes have separate builders; use the mode recorded in validated state.