fix: sf nodes extend price calculation#253
Conversation
|
Cursor Agent can help with this pull request. Just |
Changed Files
|
Two bugs caused the multi-node extend confirmation to display ~10x the correct price: 1. The quote API was called with quantity=8 (GPUs per node) instead of quantity=1 (one node per quote). The API's quantity parameter means 'number of nodes', not GPUs. This inflated each quote's total price by 8x. 2. The multi-node total was computed by summing raw quote prices, which include the full quoted duration. Because the quote request adds flexibility (up to +1 hour), a 4-hour request could yield 5-hour quotes, adding another ~1.25x. Combined: 8 * 1.25 = 10x. Fix: - Change quantity from 8 to 1 in the per-node getQuote call - Normalize multi-node total using per-node-hour rates (via getPricePerGpuHourFromQuote) multiplied by the actual requested duration, matching the single-node code path Co-authored-by: Daniel Tao <danieltaox@gmail.com>
00d5889 to
713954d
Compare
|
- Surface "estimate covers N of M nodes" when any per-node getQuote returns null so the displayed total doesn't silently understate the bill when some nodes hit no-liquidity but the extend loop still attempts them up to --max-price. - Switch the multi-node total from .toFixed(0) to .toFixed(2) to match the single-node /node/hr display. Generated with [Indent](https://indent.com) Co-Authored-By: Indent <noreply@indent.com>
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
sf nodes extend price calculation
Fixes
sf nodes extendcommand showing 10x inflated prices by correcting quote API parameters and price calculation logic.The previous implementation incorrectly passed
quantity: 8(GPUs per node) to the quote API'squantityparameter (number of nodes), inflating each quote by 8x. Additionally, the multi-node total summed raw quote prices, which included an extra hour for duration flexibility, leading to a further ~1.25x overestimation. These compounded to a ~10x error.Slack Thread