compute_price
Compute a price. Returns the price, the function that produced it, the metered cost and a trace of each stage. Send currency plus unit_cost (what the work costs you) or current_price. Missing inputs return an error naming them. For a competitor offer, put competitor_price, competitor_currency and competitive_action in metadata. To pay for this one call with x402, pass payment (call without it to read the price). A result with valid_until (RFC 3339) holds only until then. confidence is the function's own 0 to 1 score for its price, not a probability that a buyer accepts. price_statement says what the answer is: a third party's estimate for you, or the workspace's commitment when a signed quote is attached.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"currency": "<currency>"
},
"name": "compute_price"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geo | No | Optional geography hint, e.g. US. | |
| payer | No | Optional. Who pays, as distinct from who calls: an agent wallet, a person by card, or a company billed later. | |
| intent | No | Optional. The spending limit the buyer approved, e.g. a card network mandate. The result says whether the price fits it. | |
| channel | No | Optional. The sales channel, e.g. an agent marketplace. With a rate saved by set_channel_rates, the price covers the channel's cut. | |
| payment | No | Optional. The signed x402 payment, base64, as sent in an X-PAYMENT or PAYMENT-SIGNATURE header; or, where the answer offers MPP tempo, the whole Payment-Authorization value ("Payment " and the credential). Omit it to read what the call costs and how to pay; nothing is charged until you send it. | |
| routing | No | Optional. Which functions may answer this call, by UUID from list_functions. If none qualifies, the call is refused before any charge. | |
| currency | Yes | Three-letter ISO currency code, e.g. USD. | |
| metadata | No | Optional context. Competitive pricing: competitor_price, competitor_currency and competitive_action (match, or undercut with undercut_pct); confirm the products are comparable. Or market_query (the job in plain words) to look up market prices instead. | |
| max_price | No | Optional maximum acceptable price. | |
| min_price | No | Optional minimum acceptable price. A competitive offer needs this or a declared unit_cost and target_margin_pct. | |
| unit_cost | No | What the work costs you. It lets lastprice/cost-plus price with no current_price, which is the usual case when pricing a task you are about to run. Routing picks a function that can use it; to require cost-plus, pass its UUID from list_functions as function_id. | |
| buyer_type | No | Optional. Who the price is for: an AI agent or a person. Recorded with the quote only. | |
| no_explore | No | If true, give this price exactly as computed, without the small per-call variation a workspace may run so learned pricing can learn what buyers will pay (see get_price_exploration). | |
| product_id | No | Optional identifier of what is being priced. | |
| buyer_agent | No | Optional. The buying agent, e.g. chatgpt. A label recorded with the quote only. | |
| function_id | No | Optional explicit pricing function UUID to use. | |
| product_type | No | Optional category. Defaults to "custom". | |
| buyer_ceiling | No | Optional. The most the buyer says it will pay, in the request currency (its budget, spend limit or offer cap). Never reaches the pricing function, so it cannot set the price; the model layer reads it as evidence about the buyer and checks it against what the buyer then does. Echoed in price_object.evidence.declared_ceiling. | |
| current_price | No | The current or reference price. Optional: functions that price relative to an incumbent need it, but lastprice/cost-plus prices from unit_cost instead. | |
| outcome_terms | No | Optional, for a price charged per outcome: when the outcome counts as failed and what is owed then. The result echoes the terms normalised, with complete false until success_definition, resolve_by and on_timeout are all set. | |
| idempotency_key | No | Optional. A new value (e.g. a UUID) for each call you mean to make; send the SAME value if you retry after a timeout or error you cannot interpret, and the call is computed and charged once. Ignored without a credential. | |
| learned_routing | No | Optional. With routing_preference cheapest, fastest, round_robin or weighted, let the router learn from your own calls which function serves you best (see get_learned_routing). Ignored with a function_id. | |
| customer_segment | No | Optional segment, e.g. enterprise. | |
| target_margin_pct | No | Margin on price for cost-plus, not markup on cost: price = unit_cost / (1 - margin). Defaults to 30. | |
| routing_preference | No | How to route across pricing functions. Defaults to "default". | |
| include_explanation | No | If true, ask for an explanation and confidence with the price. | |
| include_buyer_envelope | No | If true, with metadata.category set, the result adds buyer_envelope: what buyers' spend limits allowed in that category (pooled over 5 or more buyers) and where this price sits. It never changes the price. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | What sort of claim the price is: an estimate by a pricing function, advice rather than a commitment. Term: lp:price-kind.computed. | |
| message | No | A short sentence about the result that an agent can show its person. | |
| receipt | No | The usage event that records this call. Pass receipt.id to report_outcome only when it differs from request_id; when no usage event was recorded, receipt.id falls back to request_id and there is nothing to report against. Term: lp:usage-event. | |
| currency | No | ISO 4217 code of computed_price. | |
| confidence | No | The function's own 0 to 1 score for this price; not a probability that a buyer accepts. Term: lp:confidence.quote. | |
| request_id | No | This call's id; the receipt id unless receipt.id says otherwise. | |
| explanation | No | Why the function chose this price, in plain words; null when it gave none. | |
| function_id | No | The pricing function that produced the price. Term: lp:pricing-function. | |
| valid_until | No | RFC 3339; the price holds only until then. | |
| alternatives | No | Other prices the function considered, each with its confidence and a label. | |
| price_object | No | What the price means beside the number: the expected acceptance at each price, the range it was chosen in, what it was conditioned on, the evidence behind it, what it cost to compute and whether it was an exploring draw. Term: lp:price-object. | |
| function_name | No | Its name, such as lastprice/cost-plus. Term: lp:pricing-function. | |
| computed_price | No | The price the function returned, after the caller's bounds and the workspace's guardrails. Term: lp:computed-price. | |
| price_statement | No | What this answer is: a third party's estimate for you (standing estimate), or the workspace's commitment until valid_until when a signed quote is attached (speaker seller, standing commitment). Term: lp:price-statement. |