{
  "openapi": "3.1.0",
  "info": {
    "title": "Sparecycle scheduler API",
    "version": "1",
    "summary": "Submit checked AI jobs, read their status and private results, and read epochs, payouts and nodes.",
    "description": "Every job runs on two nodes with different owners; a job is charged only when the two results match. JSON everywhere; errors are { \"error\": \"<code>\", \"message\": \"…\" }; amounts are decimal strings in wei; times are unix seconds. The scheduler is centralized in this MVP.",
    "license": {
      "name": "MIT",
      "identifier": "MIT"
    }
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "This site's scheduler API"
    }
  ],
  "externalDocs": {
    "description": "Guides and reference",
    "url": "/docs/api"
  },
  "tags": [
    {
      "name": "Jobs",
      "description": "Submit a job, follow its status, read its result."
    },
    {
      "name": "Epochs",
      "description": "Six-hour payout periods: payout trees, Merkle proofs and charge lists."
    },
    {
      "name": "Models",
      "description": "The public model catalog: what runs, what it costs per work unit, the limits and live capacity. No key."
    },
    {
      "name": "Network",
      "description": "Scheduler status, nodes and health."
    },
    {
      "name": "Payments",
      "description": "Prepaid balances in the SparecycleJobPayments contract."
    },
    {
      "name": "Sign-in",
      "description": "Gasless wallet sign-in (EIP-4361) to read results of jobs the wallet paid for."
    },
    {
      "name": "Nodes (signed)",
      "description": "Called by the node client. Every request is signed by the node key."
    },
    {
      "name": "Operator",
      "description": "Operator endpoints. Bearer SCHEDULER_ADMIN_TOKEN; 503 when none is configured."
    },
    {
      "name": "Meta",
      "description": "This API description."
    },
    {
      "name": "API keys",
      "description": "Spend-only keys per wallet: daily cap, kill switch, never withdraw. Managed with a wallet session."
    },
    {
      "name": "OpenAI-compatible",
      "description": "Chat completions and image generations through the two-node check; asynchronous by default."
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol server (Streamable HTTP, stateless) with four tools."
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Scheduler and database liveness",
        "tags": [
          "Network"
        ],
        "responses": {
          "200": {
            "description": "The scheduler and its database answer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "db": {
                      "const": "ok"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The database could not be opened.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": false
                    },
                    "db": {
                      "const": "error"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Open epoch, node and job counters, last settled root, trust model",
        "tags": [
          "Network"
        ],
        "responses": {
          "200": {
            "description": "Current status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          }
        }
      }
    },
    "/epochs": {
      "get": {
        "operationId": "listEpochs",
        "summary": "Every epoch the scheduler knows, newest first",
        "tags": [
          "Epochs"
        ],
        "responses": {
          "200": {
            "description": "Epochs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "epochs"
                  ],
                  "properties": {
                    "epochs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Epoch"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/epochs/{id}/tree": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EpochId"
        }
      ],
      "get": {
        "operationId": "getEpochTree",
        "summary": "The published payout tree of a closed epoch",
        "tags": [
          "Epochs"
        ],
        "responses": {
          "200": {
            "description": "Every leaf of the epoch's Merkle tree (one per owner wallet).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpochTree"
                }
              }
            }
          },
          "400": {
            "description": "The epoch id is not a non-negative integer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-epoch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "epoch-open: the tree is published when the epoch closes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/epochs/{id}/proof": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EpochId"
        }
      ],
      "get": {
        "operationId": "getEpochProof",
        "summary": "Amount, leaf and Merkle proof for claim(epochId, amount, proof)",
        "tags": [
          "Epochs"
        ],
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Address"
            },
            "description": "The owner wallet."
          }
        ],
        "responses": {
          "200": {
            "description": "The account's payout and its proof.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpochProof"
                }
              }
            }
          },
          "400": {
            "description": "invalid-account or an invalid epoch id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-epoch, or not-in-root when the account has no payout in this epoch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "epoch-open",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/epochs/{id}/charges": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EpochId"
        }
      ],
      "get": {
        "operationId": "getEpochCharges",
        "summary": "What an epoch's charge committed: per-customer totals and the jobs-tree leaves (v2), or the per-job list (v1)",
        "description": "hashRule \"v2-jobs-merkle\" (every charge since job receipts): listHash, the listHash of the Charged event of SparecycleJobPayments for that epoch, is the root of a Merkle tree over the paid and team jobs that reached a final charge status since the last confirmed charge (charged, released = not charged, unpaid). The answer lists each customer's total (equal to the CustomerCharged events) and the sorted leaves, so anyone can rebuild the root; it names no job ids, per-job payers or prices, and each leaf includes a random salt that only the payer's receipt carries, so a leaf cannot be matched to a job from public data. A payer proves their own job with its receipt (GET /jobs/{id}/receipt).\n\nLeaf: keccak256(abi.encode(uint64 epochId, bytes32 jobId, address payer, uint256 priceWei, uint8 verdict, uint8 chargeStatus, bytes32 outputHash, bytes32 salt)); salt = 32 random bytes per leaf, given only in the payer's receipt; sorted-pair keccak256 tree as the payout tree (src/lib/merkle.ts). Codes: verdict agreed 1, disagreed 2, expired 3, rejected 4; chargeStatus charged 1, released 2, unpaid 3.\n\nCharges stored before job receipts keep their v1 answer unchanged: the per-job list, whose keccak256 (UTF-8 JSON) is the listHash. status is \"none\" when nothing was charged in the epoch (no Charged event, so no on-chain anchor for receipts of that epoch).",
        "tags": [
          "Epochs",
          "Payments"
        ],
        "responses": {
          "200": {
            "description": "The charge.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Charges"
                }
              }
            }
          },
          "400": {
            "description": "The epoch id is not a non-negative integer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs": {
      "get": {
        "operationId": "listJobs",
        "summary": "Recent jobs (prompt hashes only, never prompts)",
        "tags": [
          "Jobs"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobs"
                  ],
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Job"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "submitJob",
        "summary": "Submit a job: a free trial job, or a paid job from a prepaid balance",
        "description": "Free trial: send the job request itself. Limited per IP address per hour (JOB_RATE_LIMIT; the x-sc-rate-limit header of the answer gives the limit).\n\nPaid: send { request, payment }. payment.signature is an EIP-191 personal_sign by payment.payer of this message (lines joined by \\n):\n\n    Sparecycle: pay for one job from my balance\n    Chain: <chain id>\n    Payments contract: <payments contract address, lowercase>\n    Job request: <sha256 of JSON.stringify(request), 0x-prefixed lowercase hex>\n    Price: <priceWei> wei\n    Issued: <issued, unix seconds>\n\nThe signature is accepted for 600 seconds after issued. priceWei must equal the job's work units times priceWeiPerUnit (GET /payments/account); otherwise 409 price-changed returns the right price.\n\nThe answer carries the job's readSecret once: keep it to read the result (GET /jobs/{id}/result with Authorization: Bearer <readSecret>). The scheduler stores only its hash.\n\nPOST /api/v1/jobs also accepts `Authorization: Bearer sck_…` (security: apiKey) with the job request itself and no `payment` block: the job is paid from the key's wallet, within the key's daily cap (429 `key-daily-cap`), and gets no readSecret. 401 `invalid-api-key` for an unknown or disabled key.",
        "tags": [
          "Jobs"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobRequest"
                  },
                  {
                    "$ref": "#/components/schemas/PaidJobRequest"
                  }
                ]
              },
              "examples": {
                "freeText": {
                  "summary": "Free trial text job",
                  "value": {
                    "kind": "text",
                    "params": {
                      "model": "qwen2.5-1.5b",
                      "prompt": "Name three uses for an idle GPU.",
                      "maxTokens": 64
                    }
                  }
                },
                "freeImage": {
                  "summary": "Free trial image job",
                  "value": {
                    "kind": "image",
                    "params": {
                      "model": "sd15",
                      "prompt": "a lighthouse at dusk, watercolor",
                      "width": 512,
                      "height": 512,
                      "steps": 15
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Queued. Sent with Cache-Control: private, no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitJobResponse"
                }
              }
            }
          },
          "400": {
            "description": "invalid-job (with field), invalid-payment or stale-payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "bad-payment-signature",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "insufficient-balance (with available and priceWei).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "price-changed (with priceWei) or payment-used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate-limited (with retryAfter, unix seconds).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "no-node-pair (with model, and retryAfter in seconds when the GPU pool is waiting to try again): no two machines with different owners can take this model now, neither online nor through the GPU pool. Nothing is queued, held, counted against a limit or charged. Also queue-full, or payments-off when paid jobs are not enabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "operationId": "getJob",
        "summary": "A job's status, timestamps and parameters (never the prompt)",
        "description": "output is the result URL when the job is agreed and the caller may read it (the job's read secret, or a session of the wallet that paid). Always Cache-Control: private, no-store.",
        "tags": [
          "Jobs"
        ],
        "security": [
          {},
          {
            "readSecret": []
          },
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobDetail"
                }
              }
            }
          },
          "400": {
            "description": "invalid-job-id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/result": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "operationId": "getJobResult",
        "summary": "The result of an agreed job (image/png or text/plain), for its owner only",
        "description": "Send the job's read secret (Authorization: Bearer <readSecret>) or the session cookie of the wallet that paid. Anonymous requests get an empty 401. Rate limited per viewer. Always Cache-Control: private, no-store and Vary: Authorization, Cookie.",
        "tags": [
          "Jobs"
        ],
        "security": [
          {
            "readSecret": []
          },
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The result.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/png"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No credentials were sent (empty body)."
          },
          "403": {
            "description": "These credentials cannot read this job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-job, or no-output when the output was not stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "no-output: the job is not agreed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate-limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headJobResult",
        "summary": "Same checks as GET, without the body",
        "tags": [
          "Jobs"
        ],
        "security": [
          {
            "readSecret": []
          },
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Readable."
          },
          "401": {
            "description": "No credentials."
          },
          "403": {
            "description": "Not allowed."
          }
        }
      }
    },
    "/jobs/{id}/invoice": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "operationId": "getJobInvoice",
        "summary": "The private invoice of a paid or team job (a stub for a free trial job)",
        "description": "Price, rounded 5% protocol cut (charged per epoch batch), verdict, charge status, output hash (sha256 of the agreed output, not the file), epochs, the charge and root transactions, and round / maxRounds (a paid job re-checked on another pair: the price stays held, the verdict and charge are the final round's). Same credentials as /jobs/{id}/result, enforced whatever OUTPUT_AUTH says. A free trial job answers { payment: \"free\", invoice: false, note: \"free trial, no charge\" }. Always Cache-Control: private, no-store and Vary: Authorization, Cookie.",
        "tags": [
          "Jobs"
        ],
        "security": [
          {
            "readSecret": []
          },
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The invoice (version 1), or the free trial stub."
                }
              }
            }
          },
          "400": {
            "description": "bad-id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No credentials were sent (empty body)."
          },
          "403": {
            "description": "These credentials cannot read this job's invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/receipt": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "operationId": "getJobReceipt",
        "summary": "The payer's receipt of a paid or team job, checkable against the Charged event (a stub for a free trial job)",
        "description": "Available from the verdict on. state is \"provisional\" until the charge that commits the job's leaf to a jobs root is confirmed on-chain, then \"sealed\": anchor then holds the leaf inputs (with the leaf's random salt, served only here), the leaf, the Merkle proof and the jobs root (the listHash of the Charged event of epochId, sent in chargeTx). nodes holds both nodes' EIP-712 receipts (domain Sparecycle v1: jobId, node, outputHash, gpuMs, epoch).\n\npending.reason of a provisional receipt: waiting-for-charge, charge-unconfirmed, no-anchor (the epoch close after the verdict charged nothing, so there is no Charged event to anchor it; it goes into the next charge's jobs root) or charged-before-receipts (charged in a v1 charge list, no proof).\n\nThe epoch payout root (GET /epochs/{id}/tree) covers node payouts only, never jobs. Save the receipt as a file and check it in a browser against the chain's public RPC, without this API (the Verify panel on the Jobs page). Same credentials as /jobs/{id}/invoice, enforced whatever OUTPUT_AUTH says. Always Cache-Control: private, no-store and Vary: Authorization, Cookie.",
        "tags": [
          "Jobs"
        ],
        "security": [
          {
            "readSecret": []
          },
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "The receipt, or the free trial stub.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/JobReceipt"
                    },
                    {
                      "$ref": "#/components/schemas/FreeReceiptStub"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid-job-id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No credentials were sent (empty body)."
          },
          "403": {
            "description": "These credentials cannot read this job's receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "unknown-job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "no-verdict: the two results are not compared yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/output": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "operationId": "getJobOutputRetired",
        "summary": "Retired: use /jobs/{id}/result",
        "description": "Answers 410 while results are private (OUTPUT_AUTH=enforce, the live setting).",
        "deprecated": true,
        "tags": [
          "Jobs"
        ],
        "responses": {
          "410": {
            "description": "gone: results moved to /jobs/{id}/result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headJobOutputRetired",
        "summary": "Retired: use /jobs/{id}/result",
        "deprecated": true,
        "tags": [
          "Jobs"
        ],
        "responses": {
          "410": {
            "description": "Gone."
          }
        }
      }
    },
    "/catalog": {
      "get": {
        "operationId": "getCatalog",
        "summary": "The model catalog: price per unit, how units are counted, limits and live capacity (no key)",
        "description": "Exactly the models the scheduler runs (MODELS in src/lib/protocol.ts), also served at /v1/catalog. /models (OpenAI list shape) stays behind an API key.\n\nprice.priceWeiPerUnit is the price every job is quoted at right now; price.units says how a job's work units are counted; limits are the accepted request ranges.\n\ncapacity.ready: machines online now that can run the model. capacity.standby: stopped project-run machines the GPU pool starts when a job waits. capacity.pair: \"online\" (two machines with different owners are online), \"pool\" (the GPU pool can bring a pair up, a minute or two), or null: no pair can be reached now, and creating a job of this model answers 503 no-node-pair (nothing queued, held or charged).\n\nnetwork.operators is \"project-run\" until a node of an outside owner passes the GPU gate and takes part in an agreed job.",
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "The catalog, read live (Cache-Control: no-store).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          }
        }
      }
    },
    "/nodes": {
      "get": {
        "operationId": "listNodes",
        "summary": "Registered nodes: owner wallet, GPU, backend, online state",
        "tags": [
          "Network"
        ],
        "responses": {
          "200": {
            "description": "Registered nodes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "nodes"
                  ],
                  "properties": {
                    "nodes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Node"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/payments/account": {
      "get": {
        "operationId": "getPaymentsAccount",
        "summary": "A customer's balance, held amount, available amount, spend limit and pending withdrawal",
        "tags": [
          "Payments"
        ],
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account, read from the payments contract.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "description": "invalid-address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/nonce": {
      "get": {
        "operationId": "getSignInNonce",
        "summary": "A single-use nonce for an EIP-4361 (Sign-In with Ethereum) message",
        "tags": [
          "Sign-in"
        ],
        "responses": {
          "200": {
            "description": "The nonce and the statement to sign.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInNonce"
                }
              }
            }
          },
          "429": {
            "description": "rate-limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/verify": {
      "post": {
        "operationId": "signIn",
        "summary": "Check a signed EIP-4361 message and start a session",
        "description": "Sets the HttpOnly session cookie sc_session (SameSite=Strict, 12 hours). No transaction, no gas. The body must be application/json.",
        "tags": [
          "Sign-in"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "message",
                  "signature"
                ],
                "properties": {
                  "message": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed in.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "address",
                    "expiresAt"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "address": {
                      "$ref": "#/components/schemas/Address"
                    },
                    "expiresAt": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid-sign-in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The signature, nonce, domain or chain id did not check out.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "json-required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/logout": {
      "post": {
        "operationId": "signOut",
        "summary": "End the session and clear the cookie",
        "tags": [
          "Sign-in"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "Signed out.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/nodes/register": {
      "post": {
        "operationId": "registerNode",
        "summary": "Register a node key, its owner wallet and its GPU",
        "description": "The owner signs \"Sparecycle: link node <nodeKey, lowercase> to wallet <owner, lowercase>\" once (node client: link-message).",
        "tags": [
          "Nodes (signed)"
        ],
        "security": [
          {
            "nodeSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "gpu",
                  "gpuUuid",
                  "vramMb",
                  "caps",
                  "owner",
                  "ownerSig"
                ],
                "properties": {
                  "gpu": {
                    "type": "string"
                  },
                  "gpuUuid": {
                    "type": "string"
                  },
                  "vramMb": {
                    "type": "integer"
                  },
                  "caps": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "owner": {
                    "$ref": "#/components/schemas/Address"
                  },
                  "ownerSig": {
                    "type": "string"
                  },
                  "backend": {
                    "enum": [
                      "cuda",
                      "vulkan",
                      "cpu"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "Bad or replayed node signature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "e.g. gpu-not-supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/nodes/poll": {
      "post": {
        "operationId": "pollForTask",
        "summary": "Long poll for a task (or a GPU challenge)",
        "tags": [
          "Nodes (signed)"
        ],
        "security": [
          {
            "nodeSignature": []
          }
        ],
        "responses": {
          "200": {
            "description": "A task.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "{ taskId, jobId, epoch, spec, chainId, leaseExpiresAt } or { type: \"challenge\", challengeId, spec }."
                }
              }
            }
          },
          "204": {
            "description": "Nothing to do right now."
          },
          "401": {
            "description": "Bad or replayed node signature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/nodes/heartbeat": {
      "post": {
        "operationId": "nodeHeartbeat",
        "summary": "Idle Guard: the state a node reports about its own machine",
        "description": "Node client 0.4.0+. Body { state: active | paused-busy | paused-hot | paused-hours, since? } (since in unix seconds, not in the future). Sent on every state change and at least every 60 s while paused, so a paused node stays online but gets no task. Only the state is sent: no temperatures, process names or PIDs. GET /nodes shows the state, never when the pause started.",
        "tags": [
          "Nodes (signed)"
        ],
        "security": [
          {
            "nodeSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused-busy",
                      "paused-hot",
                      "paused-hours"
                    ]
                  },
                  "since": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "{ ok: true, state, since }"
                }
              }
            }
          },
          "400": {
            "description": "invalid-heartbeat",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Bad, stale or replayed node signature.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "not-registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{taskId}/result": {
      "parameters": [
        {
          "name": "taskId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^0x[0-9a-f]{32}$"
          }
        }
      ],
      "post": {
        "operationId": "submitTaskResult",
        "summary": "Submit a task's signed result",
        "tags": [
          "Nodes (signed)"
        ],
        "security": [
          {
            "nodeSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "outputHash",
                  "gpuMs",
                  "epoch",
                  "signature"
                ],
                "properties": {
                  "outputHash": {
                    "$ref": "#/components/schemas/Hash"
                  },
                  "gpuMs": {
                    "type": "integer"
                  },
                  "epoch": {
                    "type": "integer"
                  },
                  "signature": {
                    "type": "string",
                    "description": "EIP-712 receipt signed by the node key."
                  },
                  "png": {
                    "type": "string",
                    "description": "Base64 PNG (image jobs)."
                  },
                  "text": {
                    "type": "string",
                    "description": "Text output (text jobs)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "description": "The job's status after this result: checking (waiting for the other result), agreed, disagreed or rejected, or queued when the two results of a paid or team job did not match and it goes to another pair."
                    },
                    "verdict": {
                      "const": "disagreed",
                      "description": "Only with status queued: this round's two results did not match."
                    },
                    "round": {
                      "type": "integer",
                      "description": "The job's re-check round after this result (0 = the first pair)."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/challenges/{id}/result": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "submitChallengeResult",
        "summary": "Submit the answer to a GPU challenge (unpaid, never a job)",
        "tags": [
          "Nodes (signed)"
        ],
        "security": [
          {
            "nodeSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/epochs/close": {
      "post": {
        "operationId": "closeEpoch",
        "summary": "Close the open epoch and post its root (or retry an unposted root)",
        "tags": [
          "Operator"
        ],
        "security": [
          {
            "adminToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Closed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "admin-not-configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/admin/challenges": {
      "get": {
        "operationId": "getChallengeReport",
        "summary": "A node's GPU challenge state, recent challenges and the admin audit log",
        "tags": [
          "Operator"
        ],
        "security": [
          {
            "adminToken": []
          }
        ],
        "parameters": [
          {
            "name": "nodeKey",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "admin-not-configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "adminChallengeAction",
        "summary": "Re-issue a challenge, temporarily allow a node, or revoke that (audit-logged)",
        "tags": [
          "Operator"
        ],
        "security": [
          {
            "adminToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "nodeKey",
                  "action"
                ],
                "properties": {
                  "nodeKey": {
                    "$ref": "#/components/schemas/Address"
                  },
                  "action": {
                    "enum": [
                      "reissue",
                      "allow",
                      "revoke-allow"
                    ]
                  },
                  "hours": {
                    "type": "number"
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "admin-not-configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "summary": "This API description (OpenAPI 3.1)",
        "tags": [
          "Meta"
        ],
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/keys": {
      "get": {
        "operationId": "getKeys",
        "summary": "List the signed-in wallet's API keys",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                }
              }
            },
            "headers": {
              "Cache-Control": {
                "description": "Always `private, no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          }
        }
      },
      "post": {
        "operationId": "postKeys",
        "summary": "Create a pending API key and get its link message",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dailyCapWei"
                ],
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "dailyCapWei": {
                    "type": "string",
                    "pattern": "^\\d{1,30}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pending key; the wallet signs `linkMessage` (EIP-191), then POST /api/v1/keys/{id}/activate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PendingKey"
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          },
          "409": {
            "description": "`max-keys`: the wallet has the maximum number of active or pending keys.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "429": {
            "description": "`rate-limited`: too many key creations this hour.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "503": {
            "description": "`payments-off` or `api-keys-off`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          }
        }
      }
    },
    "/keys/{id}/activate": {
      "post": {
        "operationId": "postKeysActivateById",
        "summary": "Activate a pending key with the wallet's link signature; returns the full key once",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{16}$"
            },
            "description": "Key id (16 hex characters)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "signature"
                ],
                "properties": {
                  "signature": {
                    "type": "string",
                    "pattern": "^0x[0-9a-fA-F]+$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "description": "sck_<keyId>_<secret>. Shown once."
                        },
                        "shownOnce": {
                          "const": true
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`bad-link-signature`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          },
          "404": {
            "description": "`unknown-key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "409": {
            "description": "`not-pending` or `max-keys`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "410": {
            "description": "`pending-key-expired`: create a new key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          }
        }
      }
    },
    "/keys/{id}": {
      "patch": {
        "operationId": "patchKeysById",
        "summary": "Relabel, lower or raise the daily cap, disable or re-enable a key",
        "description": "Raising the cap answers 409 `link-signature-required` with `linkMessage` and `issued`; sign the message and send `{ dailyCapWei, issued, signature }`.",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{16}$"
            },
            "description": "Key id (16 hex characters)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "dailyCapWei": {
                    "type": "string",
                    "pattern": "^\\d{1,30}$"
                  },
                  "status": {
                    "enum": [
                      "active",
                      "disabled"
                    ]
                  },
                  "issued": {
                    "type": "integer"
                  },
                  "signature": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "cancelledJobs": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`invalid-key`, `bad-link-signature` or `stale-link-signature`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          },
          "404": {
            "description": "`unknown-key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          },
          "409": {
            "description": "`link-signature-required` (with linkMessage, issued), `max-keys`, `not-active`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteKeysById",
        "summary": "Delete a key (kill switch: queued jobs are cancelled and never charged)",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{16}$"
            },
            "description": "Key id (16 hex characters)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "keyId": {
                      "type": "string"
                    },
                    "status": {
                      "const": "deleted"
                    },
                    "cancelledJobs": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          },
          "404": {
            "description": "`unknown-key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyError"
                }
              }
            }
          }
        }
      }
    },
    "/keys/disable-all": {
      "post": {
        "operationId": "postKeysDisableAll",
        "summary": "Disable every active key of the signed-in wallet",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "walletSession": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "disabled": {
                      "type": "integer"
                    },
                    "cancelledJobs": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No wallet session (empty body)."
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "postChatCompletions",
        "summary": "Create a chat completion job (qwen2.5-1.5b); async, 202 by default",
        "tags": [
          "OpenAI-compatible"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. See X402PaymentRequired.",
        "parameters": [
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "wait=20"
            },
            "description": "RFC 7240 `wait=<seconds>`: hold the request until the job has a verdict, capped by API_MAX_WAIT_SECONDS."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Same key + same body within the job TTL returns the first job instead of queuing another one."
          },
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "base64 of the JSON X402PaymentPayload"
            },
            "description": "Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. The x402 payment for this request: an EIP-3009 TransferWithAuthorization to the escrow (payTo) for exactly the quoted amount."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agreed within the Prefer: wait time.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              }
            }
          },
          "202": {
            "description": "Queued: `choices` is empty; poll `sparecycle.poll`. With x402: also a PAYMENT-RESPONSE header (base64 X402SettleResponse; `transaction` = the escrow funding) and `sparecycle.read_secret` (given once: send it as Bearer on the poll URL).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` (param set), `streaming_not_supported`, `idempotency_key_reused`; x402 only: `x402_amount_over_cap`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "`insufficient_balance` (an API key whose wallet cannot pay). Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. Without any Authorization header: `x402_payment_required` or `x402_payment_rejected`, with a PAYMENT-REQUIRED header (base64 X402PaymentRequired, also in the body's `x402` field).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`model_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "x402 only: `payment_used` (that authorization already paid; one answer for every replay), `payment_in_progress`, `payment_refunded`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "Not charged: `results_did_not_match`, `job_expired` or `content_rejected` (type `not_charged`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "`key_daily_cap_reached` or `rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`no_node_pair` (no two machines with different owners can take the model now, neither online nor through the GPU pool; nothing queued, held or charged; `x-should-retry: false`, `Retry-After` when known), `queue_full`, `payments_off`, `api_keys_off`; x402 only: `x402_unavailable`, `x402_paused`, `payment_pending`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/chat/completions/{id}": {
      "get": {
        "operationId": "getChatCompletionsById",
        "summary": "Poll a chat completion job (what chat.completions.retrieve calls)",
        "description": "With the API key that created it; an x402 job with its read secret (Bearer) instead.",
        "tags": [
          "OpenAI-compatible"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^chatcmpl-0x[0-9a-f]{64}$"
            }
          },
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "wait=20"
            },
            "description": "RFC 7240 `wait=<seconds>`: hold the request until the job has a verdict, capped by API_MAX_WAIT_SECONDS."
          }
        ],
        "responses": {
          "200": {
            "description": "`choices` filled once two nodes agree, empty before.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: another key's job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "Not charged: `results_did_not_match`, `job_expired` or `content_rejected` (type `not_charged`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "operationId": "postImagesGenerations",
        "summary": "Create an image job (sd15); async, 202 by default",
        "tags": [
          "OpenAI-compatible"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. See X402PaymentRequired.",
        "parameters": [
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "wait=20"
            },
            "description": "RFC 7240 `wait=<seconds>`: hold the request until the job has a verdict, capped by API_MAX_WAIT_SECONDS."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Same key + same body within the job TTL returns the first job instead of queuing another one."
          },
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "base64 of the JSON X402PaymentPayload"
            },
            "description": "Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. The x402 payment for this request: an EIP-3009 TransferWithAuthorization to the escrow (payTo) for exactly the quoted amount."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agreed within the Prefer: wait time.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImagesResponse"
                }
              }
            }
          },
          "202": {
            "description": "Queued: `data` is empty; poll `sparecycle.poll`. With x402: also a PAYMENT-RESPONSE header (base64 X402SettleResponse; `transaction` = the escrow funding) and `sparecycle.read_secret` (given once: send it as Bearer on the poll URL).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImagesResponse"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` (param set), `streaming_not_supported`, `idempotency_key_reused`; x402 only: `x402_amount_over_cap`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "402": {
            "description": "`insufficient_balance` (an API key whose wallet cannot pay). Only where x402 is switched on (X402_ENABLED, off by default; capped launch, INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED): a request with no Authorization header at all is paid per job with x402 v2 instead of an API key. Without any Authorization header: `x402_payment_required` or `x402_payment_rejected`, with a PAYMENT-REQUIRED header (base64 X402PaymentRequired, also in the body's `x402` field).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`model_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "409": {
            "description": "x402 only: `payment_used` (that authorization already paid; one answer for every replay), `payment_in_progress`, `payment_refunded`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "Not charged: `results_did_not_match`, `job_expired` or `content_rejected` (type `not_charged`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "429": {
            "description": "`key_daily_cap_reached` or `rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "503": {
            "description": "`no_node_pair` (nothing queued, held or charged), `queue_full`, `payments_off`, `api_keys_off`; x402 only: `x402_unavailable`, `x402_paused`, `payment_pending`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/images/generations/{id}": {
      "get": {
        "operationId": "getImagesGenerationsById",
        "summary": "Poll an image job (Sparecycle extension)",
        "description": "With the API key that created it; an x402 job with its read secret (Bearer) instead.",
        "tags": [
          "OpenAI-compatible"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^img-0x[0-9a-f]{64}$"
            }
          },
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "wait=20"
            },
            "description": "RFC 7240 `wait=<seconds>`: hold the request until the job has a verdict, capped by API_MAX_WAIT_SECONDS."
          }
        ],
        "responses": {
          "200": {
            "description": "`data` filled once two nodes agree (b64_json or url, as chosen at create).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImagesResponse"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          },
          "422": {
            "description": "Not charged: `results_did_not_match`, `job_expired` or `content_rejected` (type `not_charged`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/models": {
      "get": {
        "operationId": "getModels",
        "summary": "The two models",
        "tags": [
          "OpenAI-compatible"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "enum": [
                              "qwen2.5-1.5b",
                              "sd15"
                            ]
                          },
                          "object": {
                            "const": "model"
                          },
                          "owned_by": {
                            "type": "string"
                          },
                          "sparecycle": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIError"
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "postMcp",
        "summary": "MCP server (Streamable HTTP, stateless, JSON answers)",
        "description": "One JSON-RPC 2.0 message per POST. Tools: submit_job, get_job_status, get_job_result, get_balance; submit_job and get_job_status return receipt_url, get_job_result adds a JSON block with it after the answer, and submit_job fails with no_node_pair when no pair can take the model. Protocol 2026-07-28 (per-request _meta, server/discover) and the initialize-based 2025-11-25, 2025-06-18 and 2025-03-26.",
        "tags": [
          "MCP"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc"
                ],
                "properties": {
                  "jsonrpc": {
                    "const": "2.0"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "JSON-RPC response."
                }
              }
            }
          },
          "202": {
            "description": "A notification was accepted (no body)."
          },
          "400": {
            "description": "JSON-RPC error: -32700, -32600, -32602, -32020 header mismatch, -32022 unsupported protocol version.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or disabled API key (JSON-RPC error -31001).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Origin not allowed."
          },
          "404": {
            "description": "Unknown method (modern protocol): JSON-RPC error -32601.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getMcp",
        "summary": "Not offered (no standalone SSE stream)",
        "tags": [
          "MCP"
        ],
        "responses": {
          "405": {
            "description": "Method Not Allowed."
          }
        }
      },
      "delete": {
        "operationId": "deleteMcp",
        "summary": "Not offered (no sessions)",
        "tags": [
          "MCP"
        ],
        "responses": {
          "405": {
            "description": "Method Not Allowed."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "kebab-case code"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "Address": {
        "type": "string",
        "pattern": "^0x[0-9a-fA-F]{40}$"
      },
      "Hash": {
        "type": "string",
        "pattern": "^0x[0-9a-fA-F]{64}$"
      },
      "JobId": {
        "type": "string",
        "pattern": "^0x[0-9a-f]{64}$"
      },
      "Wei": {
        "type": "string",
        "pattern": "^[0-9]+$",
        "description": "An amount in wei, as a decimal string."
      },
      "JobStatus": {
        "enum": [
          "queued",
          "running",
          "checking",
          "agreed",
          "disagreed",
          "expired",
          "rejected"
        ]
      },
      "ImageJobRequest": {
        "type": "object",
        "required": [
          "kind",
          "params"
        ],
        "properties": {
          "kind": {
            "const": "image"
          },
          "params": {
            "type": "object",
            "required": [
              "model",
              "prompt",
              "width",
              "height",
              "steps"
            ],
            "properties": {
              "model": {
                "const": "sd15"
              },
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "negative": {
                "type": "string",
                "minLength": 0,
                "maxLength": 300
              },
              "width": {
                "type": "integer",
                "minimum": 256,
                "maximum": 512,
                "multipleOf": 64
              },
              "height": {
                "type": "integer",
                "minimum": 256,
                "maximum": 512,
                "multipleOf": 64
              },
              "steps": {
                "type": "integer",
                "minimum": 10,
                "maximum": 30
              },
              "guidance": {
                "type": "number",
                "minimum": 1,
                "maximum": 12,
                "default": 7
              },
              "seed": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Left out: the scheduler picks one, so both nodes render the same image."
              }
            }
          }
        }
      },
      "TextJobRequest": {
        "type": "object",
        "required": [
          "kind",
          "params"
        ],
        "properties": {
          "kind": {
            "const": "text"
          },
          "params": {
            "type": "object",
            "required": [
              "model",
              "prompt",
              "maxTokens"
            ],
            "properties": {
              "model": {
                "const": "qwen2.5-1.5b"
              },
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "system": {
                "type": "string",
                "minLength": 0,
                "maxLength": 500
              },
              "maxTokens": {
                "type": "integer",
                "minimum": 16,
                "maximum": 512
              }
            }
          }
        }
      },
      "JobRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageJobRequest"
          },
          {
            "$ref": "#/components/schemas/TextJobRequest"
          }
        ],
        "discriminator": {
          "propertyName": "kind"
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "payer",
          "signature",
          "issued",
          "priceWei"
        ],
        "properties": {
          "payer": {
            "$ref": "#/components/schemas/Address"
          },
          "signature": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{130}$"
          },
          "issued": {
            "type": "integer",
            "description": "Unix seconds when signed."
          },
          "priceWei": {
            "$ref": "#/components/schemas/Wei"
          }
        }
      },
      "PaidJobRequest": {
        "type": "object",
        "required": [
          "request",
          "payment"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/JobRequest"
          },
          "payment": {
            "$ref": "#/components/schemas/Payment"
          }
        }
      },
      "SubmitJobResponse": {
        "type": "object",
        "required": [
          "id",
          "status",
          "readSecret"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/JobId"
          },
          "status": {
            "const": "queued"
          },
          "priceWei": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Wei"
              },
              {
                "type": "null"
              }
            ]
          },
          "readSecret": {
            "type": "string",
            "description": "Shown once. Keep it to read the result."
          }
        }
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/JobId"
          },
          "model": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "image",
              "text"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "createdAt": {
            "type": "integer"
          },
          "settledAt": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "promptHash": {
            "$ref": "#/components/schemas/Hash"
          },
          "workUnits": {
            "type": "integer"
          },
          "epochId": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "eligible": {
            "type": "boolean"
          },
          "paid": {
            "type": "boolean",
            "description": "Its epoch's root is posted with a non-zero pot."
          },
          "payment": {
            "enum": [
              "free",
              "paid",
              "team"
            ]
          },
          "round": {
            "type": "integer",
            "minimum": 0,
            "description": "Re-check round, 0-based. 0 = the first pair of nodes. A paid or team job whose two results do not match, or whose pair gives no verdict within 40 minutes of its first lease, runs again on two nodes whose node keys, owner wallets and GPUs took no part in an earlier round (round 1, then 2), when two such nodes are registered; otherwise the mismatch is final at once. Only the final round's verdict counts and only its two nodes are paid. While round > 0 and the job is queued, running or checking, it is being re-checked on another pair; its price stays held and nothing is charged until a final agreed."
          },
          "maxRounds": {
            "type": "integer",
            "description": "The most pairs this job can be checked on: 3 for paid and team jobs, 1 for free trial jobs (no re-check)."
          }
        }
      },
      "JobDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Job"
          },
          {
            "type": "object",
            "properties": {
              "params": {
                "type": "object",
                "description": "Size, steps, guidance and seed, or maxTokens. Never the prompt."
              },
              "note": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "output": {
                "oneOf": [
                  {
                    "type": "string",
                    "description": "The result URL, when the caller may read it."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputAvailable": {
                "type": "boolean"
              },
              "outputType": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "Status": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "epoch": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "startedAt": {
                "type": "integer"
              },
              "endsAt": {
                "type": "integer"
              },
              "length": {
                "type": "integer"
              }
            }
          },
          "nodes": {
            "type": "object"
          },
          "jobs": {
            "type": "object"
          },
          "lastSettled": {
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "rootPosting": {
            "enum": [
              "configured",
              "not-configured"
            ]
          },
          "trust": {
            "const": "centralized-scheduler"
          },
          "outputAuth": {
            "enum": [
              "off",
              "enforce"
            ]
          }
        }
      },
      "Epoch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "startedAt": {
            "type": "integer"
          },
          "endedAt": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "root": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "reserved": {
            "$ref": "#/components/schemas/Wei"
          },
          "potAtClose": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Wei"
              },
              {
                "type": "null"
              }
            ]
          },
          "leaves": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "postedTx": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "open",
              "closed-unposted",
              "posted"
            ]
          }
        }
      },
      "EpochTree": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "root": {
            "$ref": "#/components/schemas/Hash"
          },
          "reserved": {
            "$ref": "#/components/schemas/Wei"
          },
          "status": {
            "type": "string"
          },
          "postedTx": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "leaves": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "account": {
                  "$ref": "#/components/schemas/Address"
                },
                "amount": {
                  "$ref": "#/components/schemas/Wei"
                },
                "leaf": {
                  "$ref": "#/components/schemas/Hash"
                }
              }
            }
          }
        }
      },
      "EpochProof": {
        "type": "object",
        "properties": {
          "epochId": {
            "type": "integer"
          },
          "account": {
            "$ref": "#/components/schemas/Address"
          },
          "amount": {
            "$ref": "#/components/schemas/Wei"
          },
          "leaf": {
            "$ref": "#/components/schemas/Hash"
          },
          "proof": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Hash"
            }
          },
          "root": {
            "$ref": "#/components/schemas/Hash"
          }
        }
      },
      "Charges": {
        "type": "object",
        "description": "hashRule \"v2-jobs-merkle\": customers + leaves (no per-job list). Older charges (v1): jobs + the v1 hashRule text. status \"none\": nothing charged.",
        "properties": {
          "epochId": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "none",
              "sending",
              "done",
              "failed"
            ]
          },
          "listHash": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalWei": {
            "$ref": "#/components/schemas/Wei"
          },
          "tx": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "hashRule": {
            "type": "string",
            "description": "\"v2-jobs-merkle\", or the v1 rule \"keccak256(utf8(JSON.stringify(jobs))) with jobs sorted by jobId\"."
          },
          "customers": {
            "type": "array",
            "description": "v2: each customer's total for the epoch, equal to its CustomerCharged event.",
            "items": {
              "type": "object",
              "properties": {
                "customer": {
                  "$ref": "#/components/schemas/Address"
                },
                "amountWei": {
                  "$ref": "#/components/schemas/Wei"
                }
              }
            }
          },
          "leaves": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Hash"
            },
            "description": "v2: the sorted leaves of the jobs tree; their root is listHash."
          },
          "leafRule": {
            "type": "string"
          },
          "codes": {
            "type": "object",
            "description": "v2: the uint8 codes of verdict and chargeStatus in a leaf."
          },
          "jobs": {
            "type": "array",
            "description": "v1 only, served as stored.",
            "items": {
              "type": "object",
              "properties": {
                "jobId": {
                  "$ref": "#/components/schemas/JobId"
                },
                "payer": {
                  "$ref": "#/components/schemas/Address"
                },
                "priceWei": {
                  "$ref": "#/components/schemas/Wei"
                },
                "apiKeyId": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "JobReceipt": {
        "type": "object",
        "description": "Version 1 of a job receipt. Every field is checked by the Verify panel; a receipt with other fields is refused.",
        "required": [
          "format",
          "version",
          "state",
          "chainId",
          "paymentsContract",
          "jobId",
          "payer",
          "priceWei",
          "verdict",
          "chargeStatus",
          "outputHash",
          "nodes",
          "epochId",
          "chargeTx",
          "anchor",
          "pending"
        ],
        "properties": {
          "format": {
            "const": "sparecycle-job-receipt"
          },
          "version": {
            "const": 1
          },
          "state": {
            "enum": [
              "provisional",
              "sealed"
            ]
          },
          "chainId": {
            "type": "integer"
          },
          "paymentsContract": {
            "$ref": "#/components/schemas/Address"
          },
          "jobId": {
            "$ref": "#/components/schemas/JobId"
          },
          "payer": {
            "$ref": "#/components/schemas/Address"
          },
          "priceWei": {
            "$ref": "#/components/schemas/Wei"
          },
          "verdict": {
            "enum": [
              "agreed",
              "disagreed",
              "expired",
              "rejected"
            ]
          },
          "chargeStatus": {
            "enum": [
              "pending",
              "charged",
              "released",
              "unpaid"
            ],
            "description": "pending only while provisional."
          },
          "outputHash": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash",
                "description": "sha256 of the kept output of an agreed job."
              },
              {
                "type": "null"
              }
            ]
          },
          "nodes": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "object",
              "properties": {
                "node": {
                  "$ref": "#/components/schemas/Address"
                },
                "outputHash": {
                  "$ref": "#/components/schemas/Hash"
                },
                "gpuMs": {
                  "type": "integer"
                },
                "epoch": {
                  "type": "integer"
                },
                "signature": {
                  "type": "string",
                  "pattern": "^0x[0-9a-fA-F]{130}$",
                  "description": "EIP-712 Receipt, domain Sparecycle v1, the chain id above."
                }
              }
            }
          },
          "epochId": {
            "oneOf": [
              {
                "type": "integer",
                "description": "The epoch whose charge committed the leaf (sealed)."
              },
              {
                "type": "null"
              }
            ]
          },
          "chargeTx": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Hash"
              },
              {
                "type": "null"
              }
            ]
          },
          "anchor": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "hashRule": {
                    "const": "v2-jobs-merkle"
                  },
                  "leafInputs": {
                    "type": "object",
                    "properties": {
                      "epochId": {
                        "type": "integer"
                      },
                      "jobId": {
                        "$ref": "#/components/schemas/JobId"
                      },
                      "payer": {
                        "$ref": "#/components/schemas/Address"
                      },
                      "priceWei": {
                        "$ref": "#/components/schemas/Wei"
                      },
                      "verdict": {
                        "type": "integer",
                        "description": "uint8 code"
                      },
                      "chargeStatus": {
                        "type": "integer",
                        "description": "uint8 code"
                      },
                      "outputHash": {
                        "$ref": "#/components/schemas/Hash",
                        "description": "0x00…00 unless agreed."
                      },
                      "salt": {
                        "$ref": "#/components/schemas/Hash",
                        "description": "The leaf's 32 random bytes. Only in this receipt, never public: keep the receipt private."
                      }
                    }
                  },
                  "leaf": {
                    "$ref": "#/components/schemas/Hash"
                  },
                  "proof": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Hash"
                    }
                  },
                  "listHash": {
                    "$ref": "#/components/schemas/Hash"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "pending": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "reason": {
                    "enum": [
                      "waiting-for-charge",
                      "charge-unconfirmed",
                      "no-anchor",
                      "charged-before-receipts"
                    ]
                  },
                  "epochId": {
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "FreeReceiptStub": {
        "type": "object",
        "properties": {
          "jobId": {
            "$ref": "#/components/schemas/JobId"
          },
          "payment": {
            "const": "free"
          },
          "receipt": {
            "const": false
          },
          "note": {
            "type": "string"
          }
        }
      },
      "Node": {
        "type": "object",
        "properties": {
          "owner": {
            "$ref": "#/components/schemas/Address"
          },
          "nodeKey": {
            "$ref": "#/components/schemas/Address"
          },
          "gpu": {
            "type": "string"
          },
          "vramMb": {
            "type": "integer"
          },
          "caps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "backend": {
            "enum": [
              "cuda",
              "vulkan",
              "cpu"
            ]
          },
          "online": {
            "type": "boolean"
          },
          "working": {
            "type": "boolean",
            "description": "Running a job right now (holds a live lease)."
          },
          "lastSeen": {
            "type": "integer"
          },
          "agreedJobs": {
            "type": "integer"
          },
          "epochAgreedJobs": {
            "type": "integer"
          },
          "project": {
            "type": "boolean",
            "description": "Run by Sparecycle (bootstrap GPU pool): never paid."
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "contract": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "priceWeiPerUnit": {
            "$ref": "#/components/schemas/Wei"
          },
          "balance": {
            "$ref": "#/components/schemas/Wei"
          },
          "held": {
            "$ref": "#/components/schemas/Wei",
            "description": "Held for this wallet's jobs that have no verdict yet."
          },
          "available": {
            "$ref": "#/components/schemas/Wei",
            "description": "balance minus held minus a pending withdrawal: what new jobs can use."
          },
          "spendLimitPerEpoch": {
            "$ref": "#/components/schemas/Wei",
            "description": "0 = no limit."
          },
          "withdrawal": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "amount": {
                    "$ref": "#/components/schemas/Wei"
                  },
                  "epoch": {
                    "type": "integer"
                  },
                  "requestedAt": {
                    "type": "integer"
                  },
                  "ready": {
                    "type": "boolean",
                    "description": "canWithdraw on the contract: withdraw() would succeed now."
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CatalogModel": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "label",
          "license",
          "source",
          "price",
          "limits",
          "capacity"
        ],
        "properties": {
          "id": {
            "enum": [
              "sd15",
              "qwen2.5-1.5b"
            ]
          },
          "kind": {
            "enum": [
              "image",
              "text"
            ]
          },
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "license": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Hugging Face repository of the weights."
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri"
          },
          "endpoint": {
            "enum": [
              "/v1/chat/completions",
              "/v1/images/generations"
            ]
          },
          "output": {
            "enum": [
              "image/png",
              "text/plain"
            ]
          },
          "backends": {
            "type": "array",
            "items": {
              "enum": [
                "cuda",
                "vulkan",
                "cpu"
              ]
            }
          },
          "vramMb": {
            "type": "integer"
          },
          "price": {
            "type": "object",
            "properties": {
              "priceWeiPerUnit": {
                "$ref": "#/components/schemas/Wei"
              },
              "units": {
                "type": "string",
                "description": "How work units are counted, in words."
              },
              "example": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  },
                  "units": {
                    "type": "integer"
                  },
                  "priceWei": {
                    "$ref": "#/components/schemas/Wei"
                  }
                }
              }
            }
          },
          "limits": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "number"
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "capacity": {
            "type": "object",
            "properties": {
              "ready": {
                "type": "integer"
              },
              "standby": {
                "type": "integer"
              },
              "pair": {
                "enum": [
                  "online",
                  "pool",
                  null
                ]
              },
              "pairReachable": {
                "type": "boolean"
              },
              "retryAfter": {
                "oneOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "Catalog": {
        "type": "object",
        "required": [
          "object",
          "models",
          "pricing",
          "network"
        ],
        "properties": {
          "object": {
            "const": "catalog"
          },
          "generatedAt": {
            "type": "integer"
          },
          "pricing": {
            "type": "object",
            "properties": {
              "currency": {
                "const": "ETH"
              },
              "priceWeiPerUnit": {
                "$ref": "#/components/schemas/Wei"
              },
              "paidJobs": {
                "type": "boolean"
              },
              "freeJobsPerHour": {
                "type": "integer"
              },
              "charged": {
                "type": "string"
              }
            }
          },
          "network": {
            "type": "object",
            "properties": {
              "operators": {
                "enum": [
                  "project-run",
                  "mixed"
                ]
              },
              "note": {
                "type": "string"
              },
              "pool": {
                "type": "object",
                "properties": {
                  "configured": {
                    "type": "boolean"
                  },
                  "canStart": {
                    "type": "boolean"
                  },
                  "retryAfter": {
                    "oneOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          },
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogModel"
            }
          }
        }
      },
      "SignInNonce": {
        "type": "object",
        "properties": {
          "nonce": {
            "type": "string"
          },
          "expiresAt": {
            "type": "integer"
          },
          "chainId": {
            "type": "integer"
          },
          "version": {
            "const": "1"
          },
          "statement": {
            "type": "string"
          }
        }
      },
      "KeyError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "message"
        ]
      },
      "OpenAIError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "type",
              "param",
              "code"
            ]
          },
          "sparecycle": {
            "type": "object"
          },
          "x402": {
            "$ref": "#/components/schemas/X402PaymentRequired"
          }
        },
        "required": [
          "error"
        ]
      },
      "X402PaymentRequirements": {
        "type": "object",
        "description": "x402 v2 PaymentRequirements, scheme exact on EVM (EIP-3009). INTERNAL REVIEW ONLY — NOT EXTERNALLY AUDITED.",
        "properties": {
          "scheme": {
            "const": "exact"
          },
          "network": {
            "type": "string",
            "description": "CAIP-2, e.g. eip155:4663",
            "example": "eip155:4663"
          },
          "amount": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Atomic units of the asset: the request's work units x the x402 price per work unit."
          },
          "asset": {
            "type": "string",
            "description": "The EIP-3009 payment asset."
          },
          "payTo": {
            "type": "string",
            "description": "The escrow contract (SparecycleX402Escrow), never a wallet."
          },
          "maxTimeoutSeconds": {
            "type": "integer"
          },
          "extra": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "assetTransferMethod": {
                "const": "eip3009"
              }
            },
            "required": [
              "name",
              "version"
            ]
          }
        },
        "required": [
          "scheme",
          "network",
          "amount",
          "asset",
          "payTo",
          "maxTimeoutSeconds",
          "extra"
        ]
      },
      "X402PaymentRequired": {
        "type": "object",
        "description": "x402 v2 PaymentRequired (PAYMENT-REQUIRED header, base64 JSON). The `sparecycle-escrow` extension says how the payment is held: in the escrow before the job is queued, forwarded only when two nodes agree, refunded otherwise.",
        "properties": {
          "x402Version": {
            "const": 2
          },
          "error": {
            "type": "string",
            "description": "Why a sent payment was refused (x402 reason code)."
          },
          "resource": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "mimeType": {
                "type": "string"
              },
              "serviceName": {
                "type": "string"
              }
            }
          },
          "accepts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/X402PaymentRequirements"
            }
          },
          "extensions": {
            "type": "object"
          }
        },
        "required": [
          "x402Version",
          "resource",
          "accepts"
        ]
      },
      "X402SettleResponse": {
        "type": "object",
        "description": "x402 v2 SettleResponse (PAYMENT-RESPONSE header, base64 JSON): the payment is held in the escrow; `transaction` funded it.",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "transaction": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "payer": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "transaction",
          "network"
        ]
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "active",
              "disabled"
            ]
          },
          "dailyCapWei": {
            "type": "string"
          },
          "spentTodayWei": {
            "type": "string"
          },
          "remainingTodayWei": {
            "type": "string"
          },
          "day": {
            "type": "string",
            "description": "UTC day, YYYY-MM-DD."
          },
          "nextResetAt": {
            "type": "integer",
            "description": "Next 00:00 UTC, unix seconds."
          },
          "createdAt": {
            "type": "integer"
          },
          "activatedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lastUsedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "disabledAt": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "ApiKeyList": {
        "type": "object",
        "properties": {
          "owner": {
            "type": "string"
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            }
          },
          "maxKeys": {
            "type": "integer"
          },
          "day": {
            "type": "string"
          },
          "nextResetAt": {
            "type": "integer"
          }
        }
      },
      "PendingKey": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "const": "pending"
          },
          "dailyCapWei": {
            "type": "string"
          },
          "linkMessage": {
            "type": "string"
          },
          "issued": {
            "type": "integer"
          },
          "expiresAt": {
            "type": "integer"
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "const": "qwen2.5-1.5b"
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "enum": [
                    "system",
                    "user"
                  ]
                },
                "content": {
                  "type": "string"
                }
              }
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 16,
            "maximum": 512
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 16,
            "maximum": 512
          },
          "temperature": {
            "type": "number",
            "description": "Accepted and ignored: decoding is greedy."
          },
          "top_p": {
            "type": "number",
            "description": "Accepted and ignored: decoding is greedy."
          },
          "stream": {
            "const": false
          },
          "n": {
            "const": 1
          }
        }
      },
      "ChatCompletion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^chatcmpl-0x[0-9a-f]{64}$"
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "const": 0
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "const": "assistant"
                    },
                    "content": {
                      "type": "string"
                    },
                    "refusal": {
                      "type": "null"
                    }
                  }
                },
                "finish_reason": {
                  "const": "stop"
                },
                "logprobs": {
                  "type": "null"
                }
              }
            }
          },
          "sparecycle": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "job_id": {
                    "type": "string",
                    "pattern": "^0x[0-9a-f]{64}$"
                  },
                  "status": {
                    "enum": [
                      "queued",
                      "running",
                      "checking",
                      "agreed",
                      "disagreed",
                      "expired",
                      "rejected"
                    ]
                  },
                  "price_wei": {
                    "type": "string"
                  },
                  "work_units": {
                    "type": "integer"
                  },
                  "charge_status": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "settled_at": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "poll": {
                    "type": "string"
                  },
                  "receipt_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "GET this job's receipt (same API key): 409 until the two results are compared, then provisional, sealed once the epoch's charge is on-chain. Check it in the browser against the Charged event (src/lib/job-receipt.ts)."
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "decoding": {
                    "const": "greedy"
                  },
                  "finish_reason_reported": {
                    "const": false
                  }
                }
              }
            ]
          }
        },
        "description": "No `usage` object: the scheduler does not count tokens."
      },
      "ImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "const": "sd15"
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "size": {
            "type": "string",
            "description": "<w>x<h>, each side 256..512 in steps of 64; default 512x512"
          },
          "n": {
            "const": 1
          },
          "response_format": {
            "enum": [
              "b64_json",
              "url"
            ]
          },
          "negative_prompt": {
            "type": "string",
            "maxLength": 300
          },
          "steps": {
            "type": "integer",
            "minimum": 10,
            "maximum": 30
          },
          "guidance": {
            "type": "number",
            "minimum": 1,
            "maximum": 12
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4294967295
          }
        }
      },
      "ImagesResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "b64_json": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "output_format": {
            "const": "png"
          },
          "size": {
            "type": "string"
          },
          "sparecycle": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "job_id": {
                    "type": "string",
                    "pattern": "^0x[0-9a-f]{64}$"
                  },
                  "status": {
                    "enum": [
                      "queued",
                      "running",
                      "checking",
                      "agreed",
                      "disagreed",
                      "expired",
                      "rejected"
                    ]
                  },
                  "price_wei": {
                    "type": "string"
                  },
                  "work_units": {
                    "type": "integer"
                  },
                  "charge_status": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "settled_at": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "poll": {
                    "type": "string"
                  },
                  "receipt_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "GET this job's receipt (same API key): 409 until the two results are compared, then provisional, sealed once the epoch's charge is on-chain. Check it in the browser against the Charged event (src/lib/job-receipt.ts)."
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^img-0x[0-9a-f]{64}$"
                  },
                  "response_format": {
                    "enum": [
                      "b64_json",
                      "url"
                    ]
                  }
                }
              }
            ]
          }
        }
      }
    },
    "parameters": {
      "JobId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/JobId"
        }
      },
      "EpochId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "responses": {},
    "securitySchemes": {
      "readSecret": {
        "type": "http",
        "scheme": "bearer",
        "description": "The job's read secret, returned once by POST /jobs as readSecret."
      },
      "walletSession": {
        "type": "apiKey",
        "in": "cookie",
        "name": "sc_session",
        "description": "Session of a signed-in wallet (POST /auth/verify), HttpOnly, 12 hours. Reads results of jobs that wallet paid for."
      },
      "nodeSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "x-sc-sig",
        "description": "Node requests carry x-sc-from (the node key), x-sc-ts (unix seconds) and x-sc-sig: an EIP-191 signature by the node key over sparecycle|METHOD|PATH|TS|sha256(body). 60-second window; each signature is accepted once."
      },
      "adminToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "SCHEDULER_ADMIN_TOKEN (operator only)."
      },
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Sparecycle API key `sck_<keyId>_<secret>`."
      }
    }
  }
}