Lesson 5 of 6 · 30 min

Price an AI Agent in Credits With a Margin Floor

Measure what each run costs, then set a credit price that keeps a fixed margin.

XDQ Tutor · AI guide

Hello. In this lesson I will take you through 5 ideas, one at a time.

  1. Why AI pricing is different
  2. Measure before you price
  3. A floor in code
  4. Revenue share and payouts
  5. Worked example: pricing a summary agent

Why it matters: Measure what each run costs, then set a credit price that keeps a fixed margin. After each idea I will ask you one quick question.

Why AI pricing is different

The short version: Every run of an AI agent has a direct cost for models, search and media.

Every run of an AI agent has a direct cost for models, search and media. ICONIQ's 2026 State of AI survey of more than 300 executives found average gross margins on AI products of 45% in 2025, with 53% expected in 2026, and usage-based pricing rising from 35% to 42% of companies in six months. Bessemer's 2025 report found its fastest-growing AI startups near 25% gross margin and steadier growers around 60%.

If you price without measuring run cost, heavy users can turn your agent into a loss.

Quick check

Why use the 90th percentile cost?

Measure before you price

The short version: Run the agent a few hundred times on realistic inputs and log the cost of each run.

Run the agent a few hundred times on realistic inputs and log the cost of each run. Look at the 90th percentile, not the average, because long inputs and repair attempts drive the expensive tail. Then decide the share of revenue you allow for AI cost, for example 30%.

The price per run is the p90 cost divided by that share. A run costing 0.12 USD at p90 with a 30% target needs at least 0.40 USD of revenue.

Quick check

With a 0.12 USD p90 cost and a 30% target, what is the minimum price?

A floor in code

The short version: Set a hard limit too, for example AI cost never above 60% of the run's revenue.

Set a hard limit too, for example AI cost never above 60% of the run's revenue. Enforce it in code: if a run's cost climbs past the limit, take more credits with the buyer's prior agreement or stop the run and return a clear status. Do not let unusual inputs quietly sell at a loss.

Refund or skip charging when the agent fails or finds nothing. Buyers forgive failures; they do not forgive being charged for them.

Quick check

What should happen when an agent fails on your side?

Revenue share and payouts

The short version: Marketplaces usually keep a share of each run and pay the developer the rest, often after a refund window.

Marketplaces usually keep a share of each run and pay the developer the rest, often after a refund window. Read the terms: what share you keep, when you are paid, and how refunds come back to you. Build those into your price so a refund does not wipe out a month's margin.

Review pricing every quarter with real cost logs, and lower prices when your costs fall from caching or cheaper models.

Worked example: pricing a summary agent

The short version: A developer logs 300 runs of a document summary agent on realistic inputs.

A developer logs 300 runs of a document summary agent on realistic inputs. The median cost is 0.02 USD, but the 90th percentile is 0.09 USD because long documents need more tokens and a repair attempt. With a target AI cost share of 30%, the minimum price per run is 0.30 USD. On a marketplace where a credit is worth a few cents, that is a whole number of credits close to that value.

The developer adds a floor: if a run's actual cost would pass 60% of its price, the agent stops and returns a status explaining the document is too long, with no charge. It also checks the marketplace terms, which hold earnings through a refund window and keep a share of each run, and confirms that the price still leaves a margin after both. After a quarter, cheaper models cut the p90 cost and the developer lowers the price.

Key takeaways
  • Measure run cost on realistic inputs and use the p90
  • Price so AI cost stays a fixed share of revenue
  • Enforce a hard margin floor in code
  • Do not charge for failed runs
  • Include marketplace share and refunds in your price
Try it

Log the cost of 200 test runs of your agent, find the p90 and set a price per run at a 30% AI cost share. Add a check that stops any run whose cost passes 60% of its price.

That is the lesson.
Mark it complete to track your progress on this device.
← PreviousValidate Agent Output and Defend Against Prompt InjectionNext lesson →Write an AI Agent Listing That Earns Trust and Passes Review