{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roroquantum-com/json-schema/roroquantum-com-quote-schema.json",
  "title": "Quote",
  "description": "`POST /v1/runs/quote` — the price of a run, with nothing charged.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roroquantum-com-openapi.yml#/components/schemas/Quote",
  "type": "object",
  "properties": {
    "machineTargetId": {
      "type": "string"
    },
    "machineName": {
      "type": "string"
    },
    "shots": {
      "type": "integer"
    },
    "perShotMilli": {
      "type": "integer",
      "description": "Per-shot price in milli-credits (your org's negotiated rate when one exists; always 0 on a free machine)."
    },
    "costMilli": {
      "type": "integer",
      "description": "Total price in milli-credits."
    },
    "costCredits": {
      "type": "number",
      "format": "double",
      "description": "Total price in credits (`costMilli / 1000`) — what `POST /v1/runs` would debit."
    },
    "free": {
      "type": "boolean",
      "description": "The run charges nothing: the machine is free by catalogue policy (RoRo's own simulators) or by the plan of the organization it bills. A free run needs no balance, so `sufficient` is true at any balance whenever `valid` is; a free run can still be refused (`valid` false, with the reason in `validationError`), for example when an institution's daily cloud-simulator allowance is used up."
    },
    "valid": {
      "type": "boolean",
      "description": "False when the run would be rejected (see `validationError`)."
    },
    "validationError": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why the run would be rejected — bad shots, empty or malformed circuit, shots outside the machine's range, or a resilience set this machine does not offer (the same text `POST /v1/runs` answers with)."
    },
    "balanceCredits": {
      "type": "number",
      "format": "double",
      "description": "The best single account that could fund the run."
    },
    "sufficient": {
      "type": "boolean",
      "description": "`valid` and the balance covers `costCredits` (always true for a 0-cost run)."
    },
    "effectiveShots": {
      "type": "integer",
      "description": "Shot-equivalents priced. On a `per-shot` quote, `costMilli == effectiveShots × perShotMilli`; equal to `shots` for a plain run."
    },
    "circuits": {
      "type": "integer",
      "description": "Circuits in the set (1 for a plain run)."
    },
    "baseCostMilli": {
      "type": "integer",
      "description": "What the run costs without resilience."
    },
    "resilience": {
      "nullable": true,
      "allOf": [
        {
          "$ref": "#/$defs/ResilienceInfo"
        }
      ]
    },
    "preflight": {
      "nullable": true,
      "allOf": [
        {
          "$ref": "#/$defs/Preflight"
        }
      ],
      "description": "What the server checked about this exact circuit on this machine before pricing it. A circuit the machine refuses makes the quote `valid: false` with the refusal as `validationError` — the same text `POST /v1/runs` answers 400 with, before anything is charged."
    },
    "priceModel": {
      "type": "string",
      "enum": [
        "free",
        "per-shot",
        "per-second",
        "per-job"
      ],
      "description": "Which basis priced this quote."
    },
    "estimatedSeconds": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "description": "On a `per-second` quote, the quantum-seconds the price assumed (billed in whole seconds, rounded up). The charge is this quote's `costMilli`; the provider's own seconds are recorded after the run and never re-billed."
    },
    "perSecondMilli": {
      "type": "integer",
      "description": "Milli-credits per quantum-second (0 on a machine without a time rate)."
    },
    "perJobMilli": {
      "type": "integer",
      "description": "Milli-credits added per job (0 when none)."
    },
    "minJobMilli": {
      "type": "integer",
      "description": "The least the job costs, in milli-credits (0 when there is no floor). On a `per-second` quote `costMilli = max(minJobMilli, perJobMilli + effectiveShots × perShotMilli + ceil(estimatedSeconds) × perSecondMilli)`."
    }
  },
  "$defs": {
    "Preflight": {
      "type": "object",
      "description": "The machine fit a quote carries. `state`: `ok`; `warn` (it fits, see `warnings`); `unavailable` (it could not be checked now — the run is checked when it starts, and the price stands).",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "ok",
            "warn",
            "unavailable"
          ]
        },
        "qubits": {
          "type": [
            "integer",
            "null"
          ]
        },
        "depth": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Circuit depth — after routing onto the device where the server routes it."
        },
        "gateCount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "twoQubitGates": {
          "type": [
            "integer",
            "null"
          ]
        },
        "layout": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer"
          },
          "description": "Not published today (null)."
        },
        "estimatedSeconds": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "A device-time projection when the service computes one (informational; the price uses the quote's own `estimatedSeconds`)."
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ResilienceInfo": {
      "type": "object",
      "description": "The resolved, expanded set a quote priced and a run was charged for, with its settled outcome.",
      "properties": {
        "readout": {
          "type": "boolean"
        },
        "calibrationShots": {
          "type": "integer",
          "description": "Shots per calibration circuit (0 without readout)."
        },
        "zneScales": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer"
          }
        },
        "zneExtrapolator": {
          "type": [
            "string",
            "null"
          ]
        },
        "zneObservable": {
          "type": [
            "string",
            "null"
          ]
        },
        "zneMode": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "histogram-heuristic",
            "observable"
          ]
        },
        "dd": {
          "type": [
            "string",
            "null"
          ]
        },
        "twirling": {
          "type": "boolean"
        },
        "circuits": {
          "type": "integer",
          "description": "1 + 2·readout + (scales − 1)."
        },
        "effectiveShots": {
          "type": "integer",
          "description": "shots × Σscales + 2 × calibrationShots."
        },
        "baseCostMilli": {
          "type": "integer",
          "description": "What the same run would cost with no resilience."
        },
        "resilienceCostMilli": {
          "type": "integer",
          "description": "The extra, in milli-credits."
        },
        "calibrationSource": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "measured-this-run"
          ],
          "description": "On a simulator the calibration measures the family model's readout rate, not a device."
        },
        "transpiledToNoiseBasis": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Simulators: the whole set was translated to the noise basis. Null on hardware."
        },
        "projectedSeconds": {
          "type": [
            "number",
            "null"
          ],
          "description": "Simulators: projected wall time from the measured throughput. Null on hardware."
        },
        "status": {
          "type": "string",
          "enum": [
            "planned",
            "applied",
            "partially-applied",
            "zne-measured-not-extrapolated",
            "readout-measured-not-applied",
            "not-applied-refunded"
          ],
          "description": "`zne-measured-not-extrapolated` / `readout-measured-not-applied`: the circuits ran and are charged, the estimate was skipped (see notes). `partially-applied` / `not-applied-refunded`: circuits that did not run were refunded (`refundedMilli`)."
        },
        "refundedMilli": {
          "type": "integer",
          "description": "Milli-credits returned for circuits of the set that did not run."
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}