# AWS Pricing Calculator API: Catch Incomplete Inference Cost Estimates in CI

Use GetUsageLinesEstimatedCost to compare planned AWS inference workloads without letting unpriced usage lines look like savings.

By Paras Madan | 2026-11-21


A cost check on an inference deployment can say traffic is getting cheaper when it just stopped pricing the GPU. That's the first failure I'd guard against when bringing the new AWS Pricing Calculator API into CI.

[AWS announced GetUsageLinesEstimatedCost on November 20](https://aws.amazon.com/about-aws/whats-new/2026/11/aws-pricing-calculator-api/). It calculates the cost of up to 500 usage lines per call without saving a workload estimate to your account. That makes it useful for a design review. It does not inspect your proposed deployment or work out which services the architecture uses. You give it the billable usage you want priced.

## Start with one change and a fixed traffic assumption

Suppose you're reviewing a change to an inference service that keeps one worker warm overnight instead of scaling all the way down. Compare the old and new designs using the same month length, request volume and traffic pattern. Change only the usage attributable to the new policy. If you change the traffic assumption at the same time, the difference won't tell you what the warmer service costs.

Write down the original quantities and units before constructing the request. A useful first comparison might cover compute, storage and outbound transfer. Include an expense only if it belongs in your design, and label anything you haven't modeled. Don't present a compute-only estimate as the complete service bill.

## Build the usage lines outside the agent

The [AWS CLI reference](https://docs.aws.amazon.com/cli/latest/reference/bcm-pricing-calculator/get-usage-lines-estimated-cost.html) identifies each line by service code, usage type and operation. Give it a unique alphanumeric key of at most 10 characters, and put the amount in the pricing unit of that usage type. Use verified billing identifiers, not a model's guess at how an instance or feature might be named.

I would keep those identifiers in a reviewed workload manifest. A coding agent can propose changing the number of planned instance hours, but the manifest should let someone else inspect the assumption and reproduce the request.

Once you've prepared the usage array as JSON, the documented CLI operation can submit it like this:

```sh
aws bcm-pricing-calculator get-usage-lines-estimated-cost \
  --usage file://usage-lines.json \
  --rate-type BEFORE_DISCOUNTS \
  --region us-east-1
```

The region here is for the [calculator service endpoint](https://docs.aws.amazon.com/cli/latest/reference/bcm-pricing-calculator/). It isn't a substitute for verifying that each usage type represents the workload you meant to price.

## Pick a rate basis and keep it visible

The API supports public rates, rates after discounts, and rates after discounts and commitments. Account preferences restrict the available choices. Start with public rates for an easy-to-repeat design comparison, then run the same workload on the authorized account-specific basis if you need it for an internal budget.

Put the chosen basis beside both totals. A baseline at public rates and a candidate after commitments is not a clean comparison. Don't expose account-specific prices in a public CI comment, and don't treat an estimate as a bill. The CLI reference notes that taxes are excluded and actual charges depend on actual usage.

## Fail the comparison when any line is unpriced

The response's `totalCost` covers priced lines only. The API lists lines it could not price in `errors`, and the supplied key connects each result to its input. Check coverage before comparing totals.

For the warm-worker proposal, require every submitted key to appear in `lineItems` and reject comparisons with entries in `errors`. If the candidate has an unpriced compute line, show its key and the response reason in a private review report. Do not substitute zero, silently drop the same line from both requests or label the candidate cheaper.

## Give reviewers the estimate and its limits

A useful CI result shows the baseline and candidate quantities, their cost difference, the returned currency, the rate basis and any omitted services. Keep a small fixture with a missing result or a returned error so that a future CI edit doesn't accidentally turn an incomplete estimate into a passing check.

The calculator can supply numbers for a review. It can't tell you how many workers will actually stay warm or whether the latency benefit is worth the increase. Keep that decision with the team examining the deployment.

I'm Paras. I work at the intersection of AI, engineering and distribution.

I help AI teams explain technical products through clear documentation, practical guides and developer-focused content.

[Book a 30-minute call](https://cal.com/paras-madan/30min).
