Documentation/Integration guide/Credits and billing
Integration guide

Credits and billing

Atomic ledger transactions, credit reservations, automatic refunds, and usage inspection.

4 min read
•Updated October 21, 2026

Atomic Ledger Accounting

Generation requests reserve credits before inference. Successful inference captures the reservation; failed inference releases it. Inspect the resource and credit ledger for the resulting transaction.

Model Credit Consumption Rates

The table shows repository seed prices. GET /v1/models returns current aliases and prices; administrators can change them:

Model AliasTask / CapabilityCredit CostExecution Mode
photoreal-v1Character Creation10 creditsAsync GPU
photoreal-v1Scene Image Generation5 creditsAsync GPU
anime-v1Character Creation10 creditsAsync GPU
anime-v1Scene Image Generation5 creditsAsync GPU
motion-v1Image-to-Video Motion25 creditsAsync GPU
voice-v1Text-to-Speech (TTS)3 creditsSync API
transcribe-v1Speech-to-Text (STT)1 creditSync API
persona-v1Chat Completion & Lore1 creditSync API
text-moderation-v1Safety & Moderation1 creditSync API

Balance & Ledger Audit Endpoints

Use GET /v1/billing to inspect your organization credit balance, and GET /v1/billing/ledger to retrieve an immutable audit trail of credit transactions.

Code Implementation

import os
import time
import requests

BASE = "https://api.apimarketplace.com"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}

def call(method, path, **kwargs):
    response = requests.request(method, BASE + path, headers=headers, timeout=300, **kwargs)
    response.raise_for_status()
    return response.json() if response.content else None

def wait(path, success):
    deadline = time.monotonic() + 900
    while time.monotonic() < deadline:
        result = call("GET", path)
        if result["status"] == success:
            return result
        if result["status"] == "failed":
            raise RuntimeError(result.get("errorMessage") or "Generation failed")
        time.sleep(3)
    raise TimeoutError("Still pending; keep the returned ID and check later")

result = call('GET', '/v1/billing')
print(result)

print("Available credits:", result["availableCredits"])
ledger = call("GET", "/v1/billing/ledger?page_size=5")
for entry in ledger["items"]:
    print(entry["createdAt"], entry["type"], entry["amount"], entry["reason"])