{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lumeta-ai/json-schema/lumeta-ai-account-schema.json",
  "title": "Account",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lumeta-ai-openapi.json#/components/schemas/Account",
  "type": "object",
  "properties": {
    "user": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "email": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "plan": {
          "type": "integer",
          "description": "The access level, as in a model's `min_plan`."
        },
        "plan_name": {
          "type": "string",
          "description": "The plan this account is on, by name (two plans can share an access level)."
        },
        "current_project": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "credits": {
      "type": "object",
      "properties": {
        "remaining": {
          "type": "integer",
          "description": "Everything you can spend: monthly, purchased and expiring."
        },
        "monthly_remaining": {
          "type": "integer"
        },
        "purchased": {
          "type": "integer"
        },
        "expiring": {
          "type": "array",
          "description": "Credits that expire, such as a friend's gift, soonest first. Counted in `remaining`; spent before your monthly credits when they expire sooner, and always before purchased ones.",
          "items": {
            "type": "object",
            "properties": {
              "credits": {
                "type": "integer",
                "description": "Left to spend."
              },
              "expires_at": {
                "type": "string",
                "description": "ISO 8601, UTC."
              },
              "reason": {
                "type": "string",
                "description": "What they are for, e.g. `gift_welcome`."
              }
            }
          }
        },
        "monthly_allowance": {
          "type": "integer"
        },
        "cycle_refreshes_at": {
          "type": "string"
        }
      }
    },
    "credential": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "kind": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "credit_cap_daily": {
          "type": [
            "integer",
            "null"
          ]
        },
        "credit_cap_monthly": {
          "type": [
            "integer",
            "null"
          ]
        },
        "spent_today": {
          "type": "integer"
        },
        "spent_this_month": {
          "type": "integer"
        },
        "cap_remaining": {
          "type": [
            "integer",
            "null"
          ]
        },
        "allow_auto_topup": {
          "type": "boolean"
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "credits_remaining": {
      "type": "integer"
    },
    "cap_remaining": {
      "type": [
        "integer",
        "null"
      ]
    }
  }
}