APERGREXDocumentation
Sections

Billing

Balance, reservations, transactions, tariffs and cost estimates via API.

Billing

All amounts are in franks (₣): the platform's internal accounting unit (1₣ = 1 RUB at the reference rate). A frank is not a currency and not a payment instrument.

The charge cycle

  1. Reservation (hold) — when an operation starts, its cost is reserved on the balance (reserved).
  2. Execution — the task runs at the provider.
  3. Confirm — actual consumption is charged; if the provider delivered less, the surplus of the reservation is returned automatically.
  4. Refund — on failure the full reservation is returned.

Transaction types in the ledger: topup, reservation, confirm, refund; debit is a rare legacy row kind.

Endpoints

WhatEndpoint
BalanceGET /v1/billing/balance
Tariff planGET /v1/billing/tariff
TransactionsGET /v1/billing/transactions
CSV exportGET /v1/billing/transactions/export?format=csv
Daily usageGET /v1/billing/usage/daily
Price catalogGET /v1/billing/pricing/catalog
Cost estimatePOST /v1/billing/pricing/estimate
Top-up payment linkPOST /v1/billing/payment/link (Idempotency-Key)
Top-up historyGET /v1/billing/payment/history
Legal invoicesPOST/GET /v1/billing/legal-invoices/*

Transactions

A paginated ledger with filters:

curl -H "X-API-Key: $FRANKLAB_KEY" \
  "https://apergrex.ru/franklab/api/v1/billing/transactions?type=confirm&page=1&limit=50"

Parameters: type (topup/reservation/confirm/refund/debit), attribution (all/company/personal — whose top-ups to include), dateFrom/dateTo (ISO 8601), page (≥1), limit (1–100, default 20). The CSV export accepts the same filters and returns up to 10,000 rows; beyond that it appends a # truncated: … comment line with the full count.

Tariffs

The tariff tier applies automatically by lifetime spend:

TierDiscount off baseThreshold
BASE
PRO12.5%> 5,000 ₣
MAX25%> 15,000 ₣
ULTRA35%> 50,000 ₣

An earned tier never degrades. Current plan and progress to the next tier: GET /v1/billing/tariff; the exact price at your tariff: POST /v1/billing/pricing/estimate.

Cost estimate

The estimate respects your tariff, model parameters and promo windows. There are no side effects: it reserves nothing and starts no tasks.

curl -X POST -H "X-API-Key: $FRANKLAB_KEY" -H "Content-Type: application/json" \
  -d '{"modelId":"mars-v1-5","duration":5,"resolution":"720p","operation":"text_to_video"}' \
  https://apergrex.ru/franklab/api/v1/billing/pricing/estimate

For reference-based models pass counts (referenceImageCount etc.) — URLs are not accepted; they only exist after upload at submit time.

For AI agents/en/docs/billing.md