Inference Logoinference.sh

Usage-Based Pricing

Store apps can charge per run using CEL expressions evaluated against task data and output metadata.


Overview

PieceRole
output_metaPer-task usage your app reports (tokens, pixels, seconds, and so on)
AppPricingStore listing config: price variables and CEL formulas
Task costWhat 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

FieldDescription
pricesNamed price variables (microcents), referenced as prices.name in expressions
upstream_pricingOptional note about upstream app pricing (display only)
resource_expressionGPU/CPU time cost (default sums resource rates × elapsed seconds)
inference_expressionPlatform inference fee
royalty_expressionRoyalty to upstream app authors
partner_expressionPartner revenue share
total_expressionFinal charge (defaults to sum of fee components when empty)
descriptionHuman-readable pricing blurb (see below)
description_renderedEvaluated 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:

text
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:

HelperUse
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

json
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

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.