Store apps can charge per run using CEL expressions evaluated against task data and output metadata.
Overview
| Piece | Role |
|---|---|
output_meta | Per-task usage your app reports (tokens, pixels, seconds, and so on) |
AppPricing | Store listing config: price variables and CEL formulas |
| Task cost | What the user was charged — see Get task cost |
All monetary values in pricing config are in microcents (1 microcent = $0.000001). Use to_dollars(microcents) in descriptions for human-readable strings.
AppPricing fields
| Field | Description |
|---|---|
prices | Named price variables (microcents), referenced as prices.name in expressions |
upstream_pricing | Optional note about upstream app pricing (display only) |
resource_expression | GPU/CPU time cost (default sums resource rates × elapsed seconds) |
inference_expression | Platform inference fee |
royalty_expression | Royalty to upstream app authors |
partner_expression | Partner revenue share |
total_expression | Final charge (defaults to sum of fee components when empty) |
description | Human-readable pricing blurb (see below) |
description_rendered | Evaluated description returned by the API after save |
Empty fee expressions use platform defaults. Patch updates merge prices keys; setting a price to 0 removes that key.
Description field
The description is evaluated as CEL against the static prices map only (no per-task variables). Helpers like to_dollars(prices.base) format amounts for display.
Plain text is supported. If you send a normal sentence (not starting with "), the API wraps it as a CEL string literal on save — you do not need to quote descriptions yourself. Use explicit CEL when you want dynamic text from prices:
1"$" + to_dollars(prices.per_image) + " per image"Fee expressions and output_meta
Inference and total formulas can read output_meta from completed tasks — the same structure you set in app code (inputs / outputs with type, tokens, dimensions, seconds, extra, and so on).
Common CEL helpers for usage-based pricing include:
| Helper | Use |
|---|---|
text_tokens(output_meta.inputs) | Sum prompt tokens |
text_tokens(output_meta.outputs) | Sum completion tokens |
image_count(output_meta.outputs) | Count generated images |
video_seconds(output_meta.outputs) | Sum video duration |
resolution(width, height) | Tier string (720p, 1080p, …) for lookup in prices |
get(task_inputs, "field", default) | Read task input fields |
get_extra(item, "key", default) | Read extra on meta items |
Expressions also receive resources, elapsed_seconds, and intermediate fee variables (resource_fee, inference_fee, and so on) where applicable.
Populate accurate output_meta on every priced run so formulas have data to evaluate. Public task APIs do not return output_meta in output — billing reads the stored metadata internally.
Example
1{2 "prices": {3 "per_1k_tokens": 50000,4 "per_image": 2000005 },6 "inference_expression": "text_tokens(output_meta.outputs) * prices.per_1k_tokens / 1000",7 "description": "About to_dollars(prices.per_1k_tokens) per 1K output tokens plus to_dollars(prices.per_image) per image"8}Draft pricing is edited in the store admin UI; publishing moves draft_pricing to live pricing on the listing version.
Next
→ Output metadata — what to report from your app
→ Task cost — how users see charges
→ Get task cost — REST breakdown