varg.ai Billing API
Balance, usage, and transaction history
Balance, usage, and transaction history
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/varg-ai:varg-ai-billing-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: varg Billing API
version: 2.0.0
description: 'Unified REST API for AI media generation at `api.varg.ai/v2`.
One API key, ~80 models across 8 providers, async jobs, stable output URLs
on `s3.varg.ai`, files with lineage, and transparent billing: 1 credit =
1 cent = $0.01, and models are priced pass-through — you pay what the
provider charges, no markup. Every amount comes as integer credits
(`*_cents` / `credits` fields) and as dollars (`*_usd` fields).
**The async job pattern:** every generation request returns `202 Accepted`
with a job object (`status: queued`). Poll `GET /jobs/{id}` until the job
reaches a terminal status (`completed`, `failed`, or `cancelled`), then read
`output.outputs[0].url`. Alternatively, set `options.webhook_url` in the
request to receive an HMAC-signed callback when the job finishes.
**Rate limits** (sliding one-minute windows; a `429` carries `Retry-After`
and `X-RateLimit-*`):
- every request with an API key or session: 1,200 a minute per credential;
- every request without one: 120 a minute per IP;
- job submits: 60 a minute per key (300 across a team);
- keyless search (`GET /skills/search`): 3 a minute per IP, then
`429 sign_in_required` — sign in (`vargai login`) or send a key to keep
searching.'
servers:
- url: https://api.varg.ai/v2
security:
- bearerAuth: []
tags:
- name: Billing
description: Balance, usage, and transaction history
paths:
/billing/balance:
get:
tags:
- Billing
operationId: getBalance
summary: Get balance
description: 'Balance breakdown in credits (1 credit = 1 cent = $0.01), each with a
`*_usd` twin in dollars. `available` = total − reserved. `reserved` is
held by in-flight jobs and is committed on completion or released on
failure.'
responses:
'200':
description: Balance
content:
application/json:
schema:
type: object
required:
- subscription_balance
- subscription_expires
- rollover_balance
- rollover_expires
- onetime_balance
- reserved
- available
- total_balance
properties:
subscription_balance:
type: integer
example: 5000
subscription_expires:
type:
- string
- 'null'
format: date-time
rollover_balance:
type: integer
example: 2000
rollover_expires:
type:
- string
- 'null'
format: date-time
onetime_balance:
type: integer
example: 1500
reserved:
type: integer
example: 300
available:
type: integer
example: 8200
total_balance:
type: integer
example: 8500
subscription_balance_usd:
type: number
example: 50
rollover_balance_usd:
type: number
example: 20
onetime_balance_usd:
type: number
example: 15
reserved_usd:
type: number
example: 3
available_usd:
type: number
example: 82
total_balance_usd:
type: number
example: 85
currency:
type: string
enum:
- usd
credit_value_usd:
type: number
description: The value of one credit in dollars — always 0.01
example: 0.01
'401':
$ref: '#/components/responses/Unauthorized'
/billing/usage:
get:
tags:
- Billing
operationId: getUsage
summary: Get usage records
parameters:
- name: from
in: query
schema:
type: string
format: date-time
- name: to
in: query
schema:
type: string
format: date-time
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 200
responses:
'200':
description: Usage records
content:
application/json:
schema:
type: object
properties:
usage:
type: array
items:
type: object
properties:
job_id:
type:
- string
- 'null'
provider:
type: string
cost_cents:
type: integer
cost_usd:
type: number
description: '`cost_cents` in dollars'
billing_type:
type: string
example: metered
billed_units:
type:
- object
- 'null'
example:
images: 1
created_at:
type: string
format: date-time
total_cents:
type: integer
description: Sum of `cost_cents` over the returned rows (limited by `limit`), not the lifetime total
total_usd:
type: number
description: '`total_cents` in dollars'
'401':
$ref: '#/components/responses/Unauthorized'
/billing/transactions:
get:
tags:
- Billing
operationId: getTransactions
summary: Get transaction ledger
description: 'Account ledger rows (spend/topup history). Negative `amount_cents` =
charge, positive = credit. Job charges carry context (`job_id`, `tool`,
`model`, `billed_units`).'
parameters:
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 200
- name: offset
in: query
schema:
type: integer
default: 0
minimum: 0
responses:
'200':
description: Transactions
content:
application/json:
schema:
type: object
properties:
transactions:
type: array
items:
type: object
properties:
id:
type: string
amount_cents:
type: integer
example: -150
amount_usd:
type: number
example: -1.5
type:
type: string
example: job_charge
account_id:
type: string
reference_kind:
type:
- string
- 'null'
reference_id:
type:
- string
- 'null'
bucket:
type:
- string
- 'null'
example: onetime
balance_after_cents:
type: integer
balance_after_usd:
type: number
billed_units:
type:
- object
- 'null'
job_id:
type:
- string
- 'null'
tool:
type:
- string
- 'null'
example: Video
tool_key:
type:
- string
- 'null'
example: video
model:
type:
- string
- 'null'
example: kling_v3
created_at:
type: string
total:
type: integer
'401':
$ref: '#/components/responses/Unauthorized'
/credits:
get:
tags:
- Billing
operationId: getCredits
summary: Get lifetime credits and usage (USD)
description: 'The OpenRouter `GET /api/v1/credits` shape, in dollars. `total_credits`
is every dollar ever put on the account (purchases, plan grants,
refunds); `total_usage` every dollar spent on jobs. `balance` is what
is spendable right now (expired credits and holds excluded), so it can
be less than `total_credits − total_usage`. The platform fee paid at
checkout is not part of `total_credits`.'
responses:
'200':
description: Credits and usage
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: object
required:
- total_credits
- total_usage
- balance
- currency
properties:
total_credits:
type: number
example: 120
total_usage:
type: number
example: 37.42
balance:
type: number
example: 82.58
currency:
type: string
enum:
- usd
'401':
$ref: '#/components/responses/Unauthorized'
components:
schemas:
ErrorResponse:
type: object
properties:
error:
type: object
properties:
code:
type: string
example: model_not_found
message:
type: string
example: 'Unknown model: flux-shnell'
details: {}
responses:
Unauthorized:
description: Missing or invalid API key / JWT
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
value:
error:
code: unauthorized
message: Invalid or missing API key or JWT
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'varg API key (`varg_...`). Get one at [app.varg.ai](https://app.varg.ai)
or run `bunx vargai login`. App sessions may alternatively send a
Supabase JWT.
'