{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amplerun-com/json-schema/amplerun-com-quote-schema.json",
  "title": "Quote",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amplerun-com-openapi.json#/components/schemas/Quote",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "quote_id",
    "expires_at",
    "machine_id",
    "gpu_count",
    "machine_rate_micro_per_hour",
    "platform_fee_bps",
    "budget_micro",
    "duration_limit_s",
    "manifest_hash",
    "image_digest",
    "terms_version",
    "meter_start"
  ],
  "properties": {
    "quote_id": {
      "$ref": "#/$defs/UUID"
    },
    "expires_at": {
      "$ref": "#/$defs/Rfc3339Utc",
      "description": "Quotes expire after 60 seconds."
    },
    "machine_id": {
      "$ref": "#/$defs/UUID"
    },
    "gpu_count": {
      "type": "integer",
      "minimum": 1
    },
    "machine_rate_micro_per_hour": {
      "$ref": "#/$defs/MicroAmount"
    },
    "platform_fee_bps": {
      "type": "integer",
      "minimum": 0
    },
    "budget_micro": {
      "$ref": "#/$defs/MicroAmount"
    },
    "duration_limit_s": {
      "type": "integer",
      "minimum": 1
    },
    "included_disk_gib": {
      "type": "integer",
      "minimum": 0
    },
    "included_egress_gib": {
      "type": "integer",
      "minimum": 0
    },
    "manifest_hash": {
      "$ref": "#/$defs/Sha256Hash"
    },
    "image_digest": {
      "$ref": "#/$defs/ImageDigest"
    },
    "terms_version": {
      "type": "string"
    },
    "meter_start": {
      "const": "verified_ready"
    },
    "template_id": {
      "$ref": "#/$defs/UUID",
      "description": "D-19(c): echoed when the quote was created for a template."
    },
    "image_ref": {
      "type": "string",
      "description": "Echoed when the request named a custom image by image_ref; image_digest is what it was pinned to."
    },
    "estimated_total_micro": {
      "$ref": "#/$defs/MicroAmount",
      "description": "D-19(c): floor(total_rate_micro_per_hour * duration_limit_s / 3600), fee included; informational — the quote's budget_micro remains the only price authority."
    },
    "asset": {
      "enum": [
        "USDC",
        "USDT"
      ],
      "description": "Additive. Settlement asset whose balance the reservation holds; USDC unless the request chose USDT."
    },
    "availability_class": {
      "$ref": "#/$defs/AvailabilityClass"
    },
    "preemption_notice_s": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 3600
        },
        {
          "type": "null"
        }
      ],
      "description": "D-22. Notice in seconds before an interruptible rental is stopped; null for dedicated."
    },
    "interruption_estimate": {
      "description": "D-22. For an interruptible quote, computed with horizon_h = the quoted duration rounded up to whole hours; null for dedicated.",
      "anyOf": [
        {
          "$ref": "#/$defs/InterruptionEstimate"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "AvailabilityClass": {
      "type": "string",
      "enum": [
        "dedicated",
        "interruptible"
      ],
      "description": "D-22. dedicated (the default) is never preempted. interruptible is sold only from idle or co-listed hosts: the host may take the machine back after preemption_notice_s seconds of notice, and billing stops at the notice."
    },
    "DecimalString": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)$",
      "description": "Unsigned base-10 integer as string; never a float."
    },
    "ImageDigest": {
      "type": "string",
      "pattern": "^[^@\\s]+@sha256:[0-9a-f]{64}$"
    },
    "InterruptionEstimate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "runs",
        "uninterrupted",
        "horizon_h",
        "computed_at",
        "summary"
      ],
      "description": "D-22, interruptible offers only. Plain observed counts, never a prediction. A run is one continuous period in which the host reported the machine offerable (from heartbeats); it counts when it ended, or has already lasted horizon_h. uninterrupted is null below the sample gate (20 runs): not enough history.",
      "properties": {
        "runs": {
          "type": "integer",
          "minimum": 0,
          "description": "Most recent decided runs counted (at most 40)."
        },
        "uninterrupted": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ],
          "description": "Of those runs, how many lasted horizon_h without interruption; null below the sample gate."
        },
        "horizon_h": {
          "type": "integer",
          "minimum": 1
        },
        "computed_at": {
          "$ref": "#/$defs/Rfc3339Utc"
        },
        "summary": {
          "type": "string",
          "description": "The counts in words, e.g. \"34 of the last 40 runs lasted 4 h without interruption\" or \"Not enough history (12 runs so far)\"."
        }
      }
    },
    "MicroAmount": {
      "$ref": "#/$defs/DecimalString",
      "description": "Money in micro-units of the settlement asset as a base-10 integer string (\"5000000\" is 5 USDC). Never a float."
    },
    "Rfc3339Utc": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$"
    },
    "Sha256Hash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    }
  }
}