{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tunova-ai/json-schema/tunova-ai-balance-schema.json",
  "title": "Balance",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tunova-ai-openapi.json#/components/schemas/Balance",
  "type": "object",
  "required": [
    "client_id",
    "balance",
    "token_balance",
    "reserved",
    "available",
    "total_liability",
    "status",
    "song_cost",
    "lyrics_cost"
  ],
  "properties": {
    "client_id": {
      "type": "string"
    },
    "balance": {
      "type": "integer",
      "description": "Current number of tokens the partner can spend"
    },
    "token_balance": {
      "type": "integer",
      "description": "Current spendable balance; in-flight holds have already been debited"
    },
    "reserved": {
      "type": "integer",
      "description": "Tokens held by non-terminal jobs (already debited from token_balance)"
    },
    "available": {
      "type": "integer",
      "description": "Spendable now: max(token_balance, 0)"
    },
    "total_liability": {
      "type": "integer",
      "description": "Remaining entitlement: max(token_balance + reserved, 0)"
    },
    "daily_token_cap": {
      "type": [
        "integer",
        "null"
      ]
    },
    "status": {
      "type": "string"
    },
    "song_cost": {
      "type": "integer"
    },
    "lyrics_cost": {
      "type": "integer"
    },
    "rate_limit_rpm": {
      "type": "integer",
      "description": "Per-key requests/minute limit"
    },
    "concurrency_limit": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Always null — no hard admission cap"
    },
    "engine_inflight": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Jobs currently queued+processing across all clients"
    }
  }
}