{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/craterview-ai/json-schema/craterview-ai-usage-response-schema.json",
  "title": "UsageResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/craterview-ai-openapi.json#/components/schemas/UsageResponse",
  "properties": {
    "credits_spent": {
      "type": "integer",
      "title": "Credits Spent",
      "description": "Credits spent, all time. Not the balance: that is `credits_remaining`."
    },
    "credits_granted": {
      "type": "integer",
      "title": "Credits Granted",
      "description": "Credits added to this account, all time — bought, granted, and arrears written off — less any refunded purchase."
    },
    "credits_remaining": {
      "type": "integer",
      "title": "Credits Remaining",
      "description": "Credits left to spend. Zero does not stop a submission: the job is accepted and runs on the community queue, as `community` says. Never below zero: what your balance does not cover is never collected, and is written off when credit next arrives or a subscription renews."
    },
    "community": {
      "type": "boolean",
      "title": "Community",
      "description": "Whether your next job goes to the community queue, which runs on shared, free capacity and can wait longer at busy times. True while the account is not paying, and a submission is still accepted. False while it is, by holding credit or by a subscription with work left this period, which puts its work on paid compute that scales with demand. A job already queued stays where it went. The same answer `community` gives on each model in the catalogue."
    },
    "subscribed_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subscribed Until",
      "description": "When the current subscription's paid period ends, ISO-8601 — null when there is no subscription. Informational: `subscribed` is the answer to which queue your work enters, decided here rather than by comparing this against your own clock."
    },
    "subscribed": {
      "type": "boolean",
      "title": "Subscribed",
      "description": "Whether a subscription is currently putting this account's work on paid compute. While it is true, work runs there at any balance — and the balance means what it always did, because a subscription grants no credit and jobs are charged as usual. A capped subscription gives it for `subscription_allowance` credits of work a period; past that, work runs on the community queue until the period renews.",
      "default": false
    },
    "subscription_allowance": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subscription Allowance",
      "description": "How many credits of work a period the subscription puts on paid compute, or null for one with no cap or when there is no subscription. Nothing is granted: jobs are charged as usual, and the window holds until the period's charges reach this figure."
    },
    "subscription_allowance_remaining": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subscription Allowance Remaining",
      "description": "Under a capped subscription, how much of `subscription_allowance` is left this period: how many more credits of work it will put on paid compute. Credit on the account is counted separately, as `credits_remaining`, and is spent first. Null where there is no cap."
    },
    "is_guest": {
      "type": "boolean",
      "title": "Is Guest",
      "description": "Whether this account has no sign-in attached to it. An account created in a browser or on a device starts this way and works normally — it submits, it spends credit, it holds keys. What it cannot do is buy or publish, and it cannot be reached from anywhere else, because there is nothing to sign in with. Signing in attaches one and this becomes false, keeping the same account, keys and history.",
      "default": false
    },
    "jobs": {
      "type": "integer",
      "title": "Jobs",
      "description": "Jobs submitted, all time, whatever their outcome."
    },
    "output_bytes": {
      "type": "integer",
      "title": "Output Bytes",
      "description": "Total size of the results produced, in bytes — the results only, not the input or the preview kept beside them."
    },
    "by_model": {
      "items": {
        "$ref": "#/$defs/ModelUsage"
      },
      "type": "array",
      "title": "By Model",
      "description": "The same figures broken down per model, largest spend first."
    },
    "jobs_in_flight": {
      "type": "integer",
      "title": "Jobs In Flight",
      "description": "Your jobs queued or running right now.",
      "default": 0
    },
    "max_jobs_in_flight": {
      "type": "integer",
      "minimum": 1.0,
      "title": "Max Jobs In Flight",
      "description": "The most you may have queued or running at once. Submitting past it is refused with a 429. It is higher once the account is signed in, so read it rather than assuming it."
    }
  },
  "type": "object",
  "required": [
    "credits_spent",
    "credits_granted",
    "credits_remaining",
    "community",
    "jobs",
    "output_bytes",
    "by_model",
    "max_jobs_in_flight"
  ],
  "$defs": {
    "ModelUsage": {
      "properties": {
        "model": {
          "type": "string",
          "title": "Model",
          "description": "The model the jobs were submitted to."
        },
        "jobs": {
          "type": "integer",
          "title": "Jobs",
          "description": "Jobs submitted to this model, all time, whatever their outcome."
        },
        "credits_spent": {
          "type": "integer",
          "title": "Credits Spent",
          "description": "Credits spent on this model, all time."
        },
        "output_bytes": {
          "type": "integer",
          "title": "Output Bytes",
          "description": "Total size of this model's results, in bytes."
        }
      },
      "type": "object",
      "required": [
        "model",
        "jobs",
        "credits_spent",
        "output_bytes"
      ],
      "title": "ModelUsage"
    }
  }
}