Set a fixed usage block
Choose counts that resemble your workload. For a short classification task, you might start with 450 prompt tokens and 25 completion tokens. Keep those counts identical across the initial price requests so that the result reflects only pricing differences. Find both model/provider pairs with price search. A model family name is not enough: a dated variant or gateway route can have a different identifier and price. The following Node.js script accepts two pairs as command-line arguments and prices both using the same counts. It requires Node.js 22 or later and makes no inference calls.Price the baseline and candidate
Save this ascompare-costs.mjs. It rejects unsuccessful or invalid cost responses so a missing price cannot appear as a saving.