Skip to main content

Billable Objects

Billing is no longer a single credit pool. An API now charges in billable objects — Credits remains the default, and providers can define more: AI tokens, compute time, bandwidth, or any resource worth metering. For providers:
  • A new Objects tab in Studio manages your API’s objects. Name, slug and dimension are fixed at creation; the slug becomes part of your API’s header contract (X-Jojapi-<slug>-Used).
  • Each object can carry a default usage formula — the metering rule endpoints inherit unless they define their own. A plain number works as a constant; a template computes the amount from each response.
  • The endpoint Billing section replaces the old fixed/flexible credits toggle: add any of your objects to an endpoint and give each a single cost — a number (fixed per request), a formula (metered), or nothing (inherits the object default). An optional description explains the metering to consumers in plain words.
  • Plans are priced per object: fixed-price plans set an included quota per object, pay-as-you-go plans define a graduated tier ladder per object. The plan form warns you when your endpoints consume an object the plan doesn’t cover — subscribers of such a plan would be blocked on those endpoints.
Documentation: Billable Objects

Transparent Per-Object Pricing

Consumers now see exactly how usage is counted, everywhere:
  • Endpoint cards show a billing box with one row per object: the fixed amount, or the exact metering formula (hover the info icon) with a last-month average per request, plus the provider’s description.
  • API pricing pages list included quotas per object on fixed plans and a tier table per object on pay-as-you-go plans, with ranges spelled out (“First 1,000”, “1,001 – 5,000”, “Over 5,000”) and a note explaining graduated pricing: each unit is billed at the rate of the tier it falls in.
  • The pay-as-you-go cost calculator estimates per object and totals the plan.

Per-Object Usage Tracking

  • Workspace → Subscriptions shows one usage bar per included object on fixed plans (“1,200 / 5,000 AI Tokens”) and per-object usage with spending on pay-as-you-go plans. Overshoot is highlighted in red with the real numbers.
  • Providers get the same per-object view of their subscribers’ usage in Studio → Subscriptions, and pay-as-you-go spending totals now sum every object’s ladder.
  • The gateway emits per-object response headers: X-Jojapi-<slug>-Used, -Remaining and -Total-Used. The classic Credits headers are unchanged.

Failed Requests Are Always Free

Responses with a 5xx status — and gateway-generated errors — now bill 0 on every object, with no exceptions. Additionally, the gateway only ever bills amounts it can actually compute: a metering formula that fails or produces a non-numeric value charges nothing instead of falling back to an implicit 1. Documentation: Adjusting Usage from Your Server