{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nuance-labs/json-schema/nuance-labs-usage-schema.json",
  "title": "Usage",
  "description": "What your organization's API keys may use, and have used today.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nuance-labs-openapi.yml#/components/schemas/Usage",
  "type": "object",
  "properties": {
    "limits": {
      "$ref": "#/$defs/ApiLimits",
      "description": "Your organization's limits."
    },
    "credits": {
      "$ref": "#/$defs/Credits",
      "description": "Today's credits (UTC)."
    },
    "credit_balance": {
      "default": 0,
      "description": "Credits added to your account beyond each day's, which last until spent and are used once today's are. 0 when there are none.",
      "type": "integer"
    },
    "available_credits": {
      "default": 0,
      "description": "What your API keys can spend now: today's credits left plus your credit balance. A conversation starts while this is above zero.",
      "type": "integer"
    },
    "active_sessions": {
      "type": "integer",
      "description": "Conversations your API keys hold active now, ones still starting included. A new one answers 409 once this reaches `limits.concurrent_sessions`."
    }
  },
  "required": [
    "active_sessions",
    "available_credits",
    "credit_balance",
    "credits",
    "limits"
  ],
  "$defs": {
    "ApiLimits": {
      "type": "object",
      "description": "What your organization's API keys may use.",
      "properties": {
        "concurrent_sessions": {
          "minimum": 0,
          "type": "integer",
          "description": "Conversations your API keys may hold active at once, ones still starting included."
        },
        "daily_credits": {
          "minimum": 0,
          "type": "integer",
          "description": "Credits your API keys may spend in a UTC day. Unspent credits don't carry over."
        },
        "api_keys": {
          "minimum": 0,
          "type": "integer",
          "description": "Live API keys your organization may hold at once."
        },
        "hourly_conversations": {
          "minimum": 0,
          "type": "integer",
          "description": "Conversations your API keys may start in any hour, ended ones included, and session tokens they may mint in any hour. Past it, a create or a mint answers 429 `start_limit`."
        }
      },
      "required": [
        "api_keys",
        "concurrent_sessions",
        "daily_credits",
        "hourly_conversations"
      ]
    },
    "Credits": {
      "type": "object",
      "description": "Your organization's credits today (UTC).",
      "properties": {
        "used": {
          "type": "integer",
          "description": "Spent today, conversations still running included."
        },
        "remaining": {
          "type": "integer",
          "description": "Today's allowance less what is spent; below zero when a conversation ran past it. Once it reaches zero, conversations draw on `credit_balance`; a new one answers 429 only when both are spent."
        },
        "renews_at": {
          "format": "date-time",
          "type": "string",
          "description": "When the next day's allowance replaces what is left (UTC)."
        }
      },
      "required": [
        "remaining",
        "renews_at",
        "used"
      ]
    }
  }
}