Inference Logoinference.sh

Usage

Team-level spend analytics and CEL pricing previews. Per-task charges are documented in Tasks — Get task cost.

Requires API key scope billing:read unless noted otherwise.

Billing API — prepaid balance and top-ups
Extend pricing — CEL formulas for store apps


Usage breakdown

GET /usage/breakdown

Returns spend over time grouped by app endpoint (namespace/name). Costs come from completed billing records (refunds excluded). Use this to build dashboards or export usage for a date range.

Query parameters

ParameterDefaultValues
range30d1h, 1d, 7d, 30d, 90d

Granularity adjusts with the range: minute buckets for 1h, hourly for 1d, daily for 7d / 30d / 90d.

Response

FieldTypeDescription
timeseriesarrayTime buckets with date and per_app cost map
per_modelarrayTop apps by spend (app_endpoint, call_count, cost) — field name is historical; values are app paths
modelsstring[]App endpoints (namespace/name) present in the series
total_costint64Sum of costs in microcents
period_start, period_endstringISO timestamps for the queried window
trend_percentnumberOptional percent change vs the previous period of equal length

Each per_model[].cost and each value in timeseries[].per_app is in microcents (1 USD = 100,000,000). See Billing API — Money units.

Example:

bash
1curl "https://api.inference.sh/usage/breakdown?range=7d" \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2"
json
1{2  "timeseries": [3    {4      "date": "2026-05-28",5      "per_app": {6        "myteam/flux-dev": 250000000,7        "infsh/echo": 500000008      }9    }10  ],11  "per_model": [12    {13      "app_endpoint": "myteam/flux-dev",14      "call_count": 42,15      "cost": 120000000016    }17  ],18  "models": ["myteam/flux-dev", "infsh/echo"],19  "total_cost": 1500000000,20  "period_start": "2026-05-28T00:00:00Z",21  "period_end": "2026-06-04T12:00:00Z",22  "trend_percent": 12.523}

Usage summary

GET /usage/summary

Aggregates usage events for the team (resource-time and model usage), not dollar totals. For spend by app, use Usage breakdown or Get task cost.

Response

FieldTypeDescription
tier_usageobjectSeconds by infrastructure tier (cloud, private)
type_usageobjectSeconds by usage event type
model_usageobjectSeconds by model identifier
total_usageint64Sum of all event quantities (seconds)

Example:

bash
1curl https://api.inference.sh/usage/summary \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2"
json
1{2  "tier_usage": {3    "cloud": 3600,4    "private": 12005  },6  "type_usage": {7    "gpu": 3000,8    "cpu": 18009  },10  "model_usage": {11    "A100": 240012  },13  "total_usage": 480014}

Evaluate CEL pricing

POST /usage/cel/evaluate

Preview CEL pricing expressions before publishing a store app. Pass draft AppPricing, sample output_meta, optional resources, usage_seconds, and task_inputs. The API returns evaluated fee components and any expression errors.

Requires billing:read.

Request body

FieldTypeDescription
pricingobjectAppPricing with prices and fee expressions
output_metaobjectSample inputs/outputs for usage-based formulas
resourcesarrayResource rows with rates (for resource_expression)
usage_secondsint64Elapsed seconds for resource pricing
task_inputsobjectRaw task input map for get(task_inputs, ...)

Response

FieldDescription
resource_fee, inference_fee, royalty_fee, partner_fee, totalEach has value (microcents) and optional error
descriptionEvaluated listing description (value string, optional error)

Example:

bash
1curl -X POST https://api.inference.sh/usage/cel/evaluate \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2" \4  -H "Content-Type: application/json" \5  -d '{6    "pricing": {7      "prices": { "per_image": 200000 },8      "inference_expression": "image_count(output_meta.outputs) * prices.per_image"9    },10    "output_meta": {11      "inputs": [],12      "outputs": [{ "type": "image", "count": 2 }]13    },14    "usage_seconds": 4515  }'

Per-task cost

GET /usage/tasks/{taskID}/cost — requires apps:read or billing:read. Documented in Tasks API.


GuideTopic
Billing APIBalance, checkout, and payment methods
Entitlements APIPlan limits (not dollar usage)
Extend pricingAuthoring CEL formulas
Tasks APIRun apps and per-task cost

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.