Vercel: price ranges for varies_by_provider rows from per-model /endpoints #451
Send to my agentClosed
tombeckenham opened this issue ·0 comments
Follow-up to #346 and #406. Since #346, the 58 Vercel rows whose listing has pricing.varies_by_provider: true store pricing: null, and they count as price gaps. Vercel does publish each route's price, one request per model:
GET https://ai-gateway.vercel.sh/v1/models/{creator}/{model}/endpoints → data.endpoints[], each with provider_name, pricing.prompt / completion (USD per token, as strings), context_length, max_completion_tokens, status and quantization.
There's no bulk form, so this takes about 58 subrequests. It must not run in the 15-minute models poll, which shares one 1,000-subrequest budget across every provider.
Do#
- Own cron, own budget. Follow the FAL precedent (
FAL_PRICING_EXTRACT_CRONS,extract-fal-pricing.ts): a separate cron firing (daily is enough; hourly if cheap) that, for each live Vercel row withvaries_by_provider, fetches its/endpointsand writes the range. Add the firing towrangler.jsoncand thesrc/worker.tsdispatch. Runbun run typesif the bindings change. - Range per #406. Store
pricingRangeusing the existing type, helper and fail-closed rules: null, never partial, when any route has no readable price, currencies differ, or a price is tiered or unreadable.pricingstays null, withfactSources.pricingRangeciting the/endpointsURL and hash.- #406's range names each route by a pinned catalog row and
/v1/estimateloads those rows. Vercel has no per-route rows, so extend the range so a route can be identified by Vercel'sprovider_nameand carry its own compiled card inline (use the existing listing compiler in@modelschemas/rate-cardfor the per-token strings). Keep one range type and one estimate path. Don't fork them. - Decide and document in the PR whether to skip endpoints with a non-zero
status(unavailable route). Whichever you choose, state it infactSources. Don't drop a route silently.
- #406's range names each route by a pinned catalog row and
- The poll keeps the range. The 15-minute poll must not clear a range it didn't fetch. When a row's listing stops saying
varies_by_provider, the listing's card applies and the range is cleared. - Estimate.
/v1/estimateand MCPestimate_coston these rows return the #406{ min, max, routes }answer, naming each end by provider. Coordinate with #450 (per-value estimates), which may touch the same estimate code. Rebase on whichever merges first. - Count. Log fetched, ranged and refused rows per run. A failed
/endpointsfetch keeps the stored range and emitsingest_failednaming the model. It never writes a partial range. - Regenerate OpenAPI, client and SKILL.md if the range shape changes. Add a changeset and a README note.
Not this#
- No
cheapestordefaultroute picked as the price. - Don't copy prices from the upstream provider's own catalog row. Only Vercel's own
/endpointsprices count, since that's what Vercel bills.
tombeckenham closed this
Sign in to join this conversation.