{
  "openapi": "3.1.0",
  "info": {
    "title": "Martini API",
    "version": "2026-08-13",
    "summary": "Generate images and video, run saved workflows, upload reusable media, and find the projects and canvases to do it in — with one API key.",
    "description": "Authenticate every request with `Authorization: Bearer <key>` (the `Key <key>` form is accepted too).\nKeys are created under Settings → Martini API and are server-side secrets.\nA key holds permissions (`generations`, `workflows`, `assets`, `billing`, each at `read` or `write`; `write` implies `read`),\nchosen when it is created and never widened. Every operation names the one it requires in `x-martini-permission`\n(`none`: any valid key); a key without it answers 403 `API_KEY_PERMISSION_MISSING` with `required` and `granted`.\nOptionally pin the envelope with `X-Martini-API-Version`; the served version is echoed on every response.\n\nGenerations and runs are asynchronous: submit, then poll the status route until the status is terminal\n(`completed`, `failed`, `cancelled`). There are no webhooks. Retry only 429 (after `Retry-After`) and 5xx.\n\nPass an `idempotencyKey` on anything you might retry: the same key returns the same object instead of charging twice.\n\nPrices are in olives (Martini credits). Every non-2xx answer is `{ \"error\": <copy>, \"code\": <STABLE_CODE> }`;\nbranch on `code`. Human-readable documentation: https://www.martini.film/docs/api and https://www.martini.film/docs/workflows.",
    "contact": {
      "name": "Martini",
      "url": "https://www.martini.film/support",
      "email": "support@martini.film"
    }
  },
  "servers": [
    {
      "url": "https://api.martini.film"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "Connection check and this document."
    },
    {
      "name": "Billing",
      "description": "Olive spend, in olives only: never money, never a provider. The balance is open to every key; the rest of the Billing API needs `billing:read` and is an enterprise feature enabled per organization. The whole namespace is rate limited per key (120 requests per minute; `X-RateLimit-*` on every answer)."
    },
    {
      "name": "Projects",
      "description": "The projects and canvases a key can generate into and run workflows in."
    },
    {
      "name": "Generations",
      "description": "Single image or video generations over the Martini-native routes."
    },
    {
      "name": "Workflows",
      "description": "Saved and placed workflows, and their runs."
    },
    {
      "name": "Assets",
      "description": "Reusable media to reference from generation inputs and workflow bins."
    },
    {
      "name": "Tools",
      "description": "Every MCP tool, callable with an API key: the manifest to generate from, one route to invoke any tool, and the operator guide that goes with them. What the `martini` CLI is built on."
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "Account"
        ],
        "summary": "Connection check",
        "description": "The key this request authenticates as and the organization it is bound to (null for an account key from `martini login` approved \"as you\"). `organizations` lists that one organization for an organization-bound key, and every organization its user belongs to for an account key. `key.permissions` is what the key may do (`family:level`); every other operation names the permission it requires in `x-martini-permission`. `key.budget` is the key’s own spend budget with where it stands, when the organization set one (`POST /v1/billing/budgets` with an `apiKey` scope). Call it first to confirm the key works and holds what you need. It checks no grant: a key from an organization holding only the Billing API grant answers here too.",
        "responses": {
          "200": {
            "description": "Who you are.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `INVALID_API_KEY`, `API_KEY_REVOKED`, `API_KEY_EXPIRED`.",
            "x-martini-error-codes": [
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `RUN_KEY_NOT_ALLOWED`, `ORGANIZATION_REQUIRED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "RUN_KEY_NOT_ALLOWED",
              "ORGANIZATION_REQUIRED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "none"
      }
    },
    "/v1/billing/balance": {
      "get": {
        "operationId": "getBalance",
        "tags": [
          "Billing"
        ],
        "summary": "Olive balance",
        "description": "The olive balance of the organization the key acts for — the pre-flight to run before submitting a batch. Olives only: never money, never what Martini pays a provider. Every key may call it; it needs no permission and no enterprise grant. `available` is what a new generation or run can spend now; `included` and `purchased` split the period’s grants; `resetsAt` says when the included allowance renews; `unlimited: true` means nothing is metered. An account key (`martini login` approved \"as you\") names the organization with `organizationId`, or gets its user’s personal organization. A workflow run key gets the `run` form instead: its own budget and `covered` — whether the organization can pay for what is left of it — never the organization’s numbers. Cached for 10 seconds per organization (`asOf` is the read time). `billingEnabled: false` means this deployment charges nothing (`olives` is null). 503 `BALANCE_UNAVAILABLE` with `Retry-After: 10` means the billing system could not be read; wait and retry — a stale balance is never served.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The balance, in the organization or the run form (branch on `kind`).",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`, `WORKFLOW_RUN_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND",
              "WORKFLOW_RUN_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BALANCE_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BALANCE_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "none"
      }
    },
    "/v1/billing/account": {
      "get": {
        "operationId": "getBillingAccount",
        "tags": [
          "Billing"
        ],
        "summary": "Billing account",
        "description": "The organization’s plan, olive balance, automatic top-up, and organization-wide budget in one read, plus `oliveValueUsd` — the public nominal value of an olive, the one USD figure in the API — so a dashboard can convert. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider. 503 `BALANCE_UNAVAILABLE` with `Retry-After: 10` means the billing system could not be read; wait and retry.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingAccount"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BALANCE_UNAVAILABLE`, `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BALANCE_UNAVAILABLE",
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/pricing": {
      "get": {
        "operationId": "getBillingPricing",
        "tags": [
          "Billing"
        ],
        "summary": "Price list",
        "description": "What this organization pays, in olives, for every model it can generate with and for agent work (chat models by their picker id, the sandbox, transcription). Prices are finished figures — the organization’s own where it has an agreement (`source: \"organization\"`), the public list price otherwise — and nothing says how a figure was reached: no provider, no cost, no terms. A model is one of three things: a `card` to compute from, a `quote` (its price depends on the request; the generate-time quote prices it), or `direct` (the organization settles it through its own provider key and is charged no olives). Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "modelId",
            "in": "query",
            "required": false,
            "description": "One model only: a catalog id (`kling-v3`) or an agent-work id (`opus-5.5`, `sandbox`, `transcription`). An id the organization cannot use answers 400 INVALID_QUERY.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The price list, models sorted by id.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pricing"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/costs": {
      "get": {
        "operationId": "getBillingCosts",
        "tags": [
          "Billing"
        ],
        "summary": "Spend over time",
        "description": "Olive spend as a cube: calendar buckets (UTC days, ISO weeks from Monday, or months) over `[from, to)`, each holding one cell per group. A cell carries `olives` (charges), `refundedOlives`, `netOlives`, and `generations` (charged generations; agent work does not count). Group by up to two of project, model, actor, user, apiKey, origin, type, and billingMode; with no `groupBy`, each bucket holds one cell with an empty `group`. The range defaults to the trailing 30 days and may cover at most 366 days. Pages run over buckets: `limit` (default 31, at most 366) buckets per page, `nextCursor` naming the next. A page that covers too many ledger rows answers 400 INVALID_QUERY: lower `limit` or narrow the range. List parameters repeat (`types=generation&types=export`), take a `[]` suffix, or join with commas. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Inclusive start, RFC 3339. Defaults to 30 days before `to`.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Exclusive end, RFC 3339. Defaults to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "bucket",
            "in": "query",
            "required": false,
            "description": "Bucket size; calendar-aligned in UTC.",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "description": "Up to two group keys. Each cell’s `group` carries exactly these members.",
            "schema": {
              "type": "array",
              "maxItems": 2,
              "items": {
                "type": "string",
                "enum": [
                  "project",
                  "model",
                  "actor",
                  "user",
                  "apiKey",
                  "origin",
                  "type",
                  "billingMode"
                ]
              }
            }
          },
          {
            "name": "projectIds",
            "in": "query",
            "required": false,
            "description": "Only charges in these projects.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "apiKeyIds",
            "in": "query",
            "required": false,
            "description": "Only charges made with these keys.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "userIds",
            "in": "query",
            "required": false,
            "description": "Only charges by these members.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "models",
            "in": "query",
            "required": false,
            "description": "Only charges for these catalog ids (`kling-v3`).",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          {
            "name": "origins",
            "in": "query",
            "required": false,
            "description": "Only charges from these surfaces.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "enum": [
                  "ui",
                  "mcp",
                  "api"
                ]
              }
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Only rows of these kinds.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "enum": [
                  "generation",
                  "export",
                  "agentWork",
                  "refund",
                  "topup",
                  "adjustment",
                  "signupBonus",
                  "transfer",
                  "paymentFee"
                ]
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Buckets per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 366,
              "default": 31
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` of the previous page, with the same filters. A cursor this server did not issue, or one outside the range, answers 400 INVALID_CURSOR.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cube, oldest bucket first.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Costs"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_CURSOR`, `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_CURSOR",
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/transactions": {
      "get": {
        "operationId": "listBillingTransactions",
        "tags": [
          "Billing"
        ],
        "summary": "Ledger",
        "description": "The organization’s olive ledger, newest first: every charge, refund, top-up, and adjustment with who caused it, which project it landed in, and — for a generation — the model and the surface it came from. Charges are negative, grants and refunds positive. Pages by keyset cursor: `limit` (default 100, at most 1000) rows per page, `nextCursor` for the next; a filter change starts a new cursor. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Only rows at or after this instant, RFC 3339.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Only rows before this instant, RFC 3339.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Only rows of these kinds.",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string",
                "enum": [
                  "generation",
                  "export",
                  "agentWork",
                  "refund",
                  "topup",
                  "adjustment",
                  "signupBonus",
                  "transfer",
                  "paymentFee"
                ]
              }
            }
          },
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "description": "Only rows in this project.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "apiKeyId",
            "in": "query",
            "required": false,
            "description": "Only rows made with this key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "description": "Only rows by this member.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "generationId",
            "in": "query",
            "required": false,
            "description": "Only the rows of this generation: its charge and any refund.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` of the previous page, with the same filters. A cursor this server did not issue, or one outside the range, answers 400 INVALID_CURSOR.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the ledger.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transactions"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_CURSOR`, `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_CURSOR",
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/invoices": {
      "get": {
        "operationId": "listBillingInvoices",
        "tags": [
          "Billing"
        ],
        "summary": "Invoices",
        "description": "The organization’s invoices, newest first: id, date, status, and what the organization paid Martini (`total`, in major units of its currency). Empty when this deployment has no billing. For the PDF, call the download route. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The invoices.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoices"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/invoices/{invoiceId}/download": {
      "get": {
        "operationId": "getBillingInvoiceDownload",
        "tags": [
          "Billing"
        ],
        "summary": "Invoice PDF link",
        "description": "A fresh link to one invoice’s PDF, good for `expiresIn` seconds (86400); ask again rather than storing it. An id that is not one of the organization’s invoices, or a draft with no PDF yet, answers 404 INVOICE_NOT_FOUND. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "description": "The invoice `id` as GET /v1/billing/invoices lists it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The link.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceDownload"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `INVOICE_NOT_FOUND`, `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "INVOICE_NOT_FOUND",
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      }
    },
    "/v1/billing/budgets": {
      "get": {
        "operationId": "listBillingBudgets",
        "tags": [
          "Billing"
        ],
        "summary": "Budgets",
        "description": "Every spend budget of the organization with where each stands — the organization-wide one first, then those on a project, a member, or an API key. A budget is a hard limit in olives, for all time or per calendar month (UTC): a charge that would cross it is refused with 402 before any work starts (SPEND_CAP_EXCEEDED on POST /v1/generations, the Generation API’s one cap code, its message naming the scope and limit; BUDGET_EXCEEDED with a `budget` detail on Martini’s own surfaces), and each `alerts` threshold emails the organization’s admins once per period when settled spend reaches it. A project spend cap or a member monthly cap set in the Martini app is a budget here too (a `project` budget for all time, a `member` budget per month), and a budget created here with that shape shows in the app. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The budgets.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Budgets"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      },
      "post": {
        "operationId": "createBillingBudget",
        "tags": [
          "Billing"
        ],
        "summary": "Create a budget",
        "description": "Cap what a scope may spend: the organization as a whole, one of its projects, one of its members (by user id), or one of its API keys. One budget per scope — a second answers 409 BUDGET_EXISTS; change the existing one instead. A scope that is not the organization’s (a project of another workspace, a user who is not a member, a revoked key) answers 404 BUDGET_SCOPE_NOT_FOUND. Alerts are soft thresholds at or below `amountOlives`; a body that does not fit answers 400 BUDGET_INVALID naming the field. Needs `billing:write` (which implies `billing:read`); a key holding only `billing:read` answers 403 API_KEY_PERMISSION_MISSING. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The scope, the limit, the period, and any alerts.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BudgetCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The budget, with where it stands now.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Budget"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BUDGET_INVALID`, `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BUDGET_INVALID",
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `BUDGET_SCOPE_NOT_FOUND`, `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "BUDGET_SCOPE_NOT_FOUND",
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `BUDGET_EXISTS`.",
            "x-martini-error-codes": [
              "BUDGET_EXISTS"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:write"
      }
    },
    "/v1/billing/budgets/{budgetId}": {
      "get": {
        "operationId": "getBillingBudget",
        "tags": [
          "Billing"
        ],
        "summary": "One budget",
        "description": "One budget with where it stands. An id that is not one of the organization’s budgets answers 404 BUDGET_NOT_FOUND. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "description": "The budget `id` as GET /v1/billing/budgets lists it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The budget.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Budget"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `BUDGET_NOT_FOUND`, `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "BUDGET_NOT_FOUND",
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:read"
      },
      "patch": {
        "operationId": "updateBillingBudget",
        "tags": [
          "Billing"
        ],
        "summary": "Change a budget",
        "description": "Raise or lower the limit, or replace the alert list; name at least one. The scope and the period are fixed — delete and create again to change them. A new `amountOlives` re-arms the period’s alerts, so a threshold already reached notifies again once spend reaches it under the new limit. The same 400 BUDGET_INVALID rules as creation apply; an id that is not one of the organization’s budgets answers 404 BUDGET_NOT_FOUND. Needs `billing:write` (which implies `billing:read`); a key holding only `billing:read` answers 403 API_KEY_PERMISSION_MISSING. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "description": "The budget `id` as GET /v1/billing/budgets lists it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The fields to change.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BudgetPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The budget as it stands now.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Budget"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BUDGET_INVALID`, `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BUDGET_INVALID",
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `BUDGET_NOT_FOUND`, `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "BUDGET_NOT_FOUND",
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:write"
      },
      "delete": {
        "operationId": "deleteBillingBudget",
        "tags": [
          "Billing"
        ],
        "summary": "Delete a budget",
        "description": "Remove the budget: the scope is no longer capped and its alerts no longer fire. Spend already recorded against the scope stays in the ledger. An id that is not one of the organization’s budgets answers 404 BUDGET_NOT_FOUND. Needs `billing:write` (which implies `billing:read`); a key holding only `billing:read` answers 403 API_KEY_PERMISSION_MISSING. Needs `billing:read` (a workflow run key is refused with RUN_KEY_NOT_ALLOWED) and the organization’s Billing API grant, an enterprise feature enabled per organization: without it the answer is 403 BILLING_API_NOT_ENABLED, and while the grant cannot be checked 503 BILLING_API_ACCESS_UNAVAILABLE with `Retry-After: 10`. An account key names the organization with `organizationId` or gets its user’s personal organization. Olives only: never money, never what Martini pays a provider, never which provider.",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "description": "The budget `id` as GET /v1/billing/budgets lists it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organizationId",
            "in": "query",
            "required": false,
            "description": "For an account key: which of the user’s organizations to read. An organization key ignores its own id and answers 404 for any other.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Confirmation.",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetDeleted"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_QUERY`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_QUERY",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_API_NOT_ENABLED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_API_NOT_ENABLED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `BUDGET_NOT_FOUND`, `ORGANIZATION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "BUDGET_NOT_FOUND",
              "ORGANIZATION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The key’s allowance on /v1/billing: 120 requests per sliding 60 seconds, the balance included.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix time (seconds) by which the window has fully turned over.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BILLING_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BILLING_API_ACCESS_UNAVAILABLE"
            ],
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before asking again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "billing:write"
      }
    },
    "/v1/projects": {
      "get": {
        "operationId": "listProjects",
        "tags": [
          "Projects"
        ],
        "summary": "List projects",
        "description": "The organization’s projects the key’s user can see, most recently joined first. Use it to pick a `projectId` by name for a run, a placement, a generation, or an upload; `canEdit` says whether the user may write there. With `query`, matches are ranked: an exact id or name first, then a name that starts with, contains, or holds every word of the query, then an id fragment.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "A project name or id, or a fragment of either. 1–200 characters.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "exactName",
            "in": "query",
            "required": false,
            "description": "With `query`: `true` keeps only projects whose name matches it exactly (case-insensitive), or whose id is it.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1–50; defaults to 20. `truncated` in the answer says whether more matched.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The projects.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectList"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/projects/{projectId}/canvases": {
      "get": {
        "operationId": "listProjectCanvases",
        "tags": [
          "Projects"
        ],
        "summary": "List a project’s canvases",
        "description": "The canvases of a project the key’s user can read, in the order the app lists them. Use it to pick a `canvasId`; the one marked `isDefault` is where the project opens. A project whose document cannot be opened answers 409 `PROJECT_DOCUMENT_TOO_LARGE` (durable — retrying will not help) or 503 `PROJECT_DOCUMENT_UNAVAILABLE` (retry).",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "description": "A project id from GET /v1/projects.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The project and its canvases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CanvasList"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `PROJECT_NOT_FOUND`.",
            "x-martini-error-codes": [
              "PROJECT_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `PROJECT_DOCUMENT_TOO_LARGE`.",
            "x-martini-error-codes": [
              "PROJECT_DOCUMENT_TOO_LARGE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`, `PROJECT_DOCUMENT_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE",
              "PROJECT_DOCUMENT_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "tags": [
          "Generations"
        ],
        "summary": "Models and their prices",
        "description": "Two lists. `models`: one entry per registered endpoint alias, with the model summary, billable unit, Martini’s list price in olives and US dollars (`listPrice`), and deprecation metadata when set; pass an entry’s `endpoint` to POST /v1/generations. `catalog`: every model the generate tools accept that is open to the caller — the roster the tools, the CLI and the MCP reach by `id`, audio and voice included; a set, mask-only or app-only model is not listed — with its list price per unit (`floor` when the model sets a per-generation minimum) and the aliases that reach it. Without a key both list what is open to everyone, at list price, so prices can be compared before signing up. With a key `models` are the endpoints that key can submit to, plus your organization’s negotiated pricing; a key that is sent is checked, so a bad one answers 401.",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "responses": {
          "200": {
            "description": "The catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Models"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "generations:read"
      }
    },
    "/v1/generations": {
      "post": {
        "operationId": "createGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Submit a generation",
        "description": "Submit a generation (or, with `mode: \"draft\"`, an editable draft that is not charged or started). Answers 201 with the generation, or 200 with the existing one when `idempotencyKey` repeats an earlier request. Then poll GET /v1/generations/{id} until `status` is completed, failed, or cancelled.",
        "requestBody": {
          "required": true,
          "description": "The endpoint alias, its model input, and optional Martini options.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGeneration"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay: the generation the first call created, in its current state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "201": {
            "description": "Created. `status` is `pending` (or `draft`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`, `UNSUPPORTED_MARTINI_MODE`, `WEBHOOKS_UNSUPPORTED`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION",
              "UNSUPPORTED_MARTINI_MODE",
              "WEBHOOKS_UNSUPPORTED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error. `code` is one of: `INSUFFICIENT_OLIVES`, `SPEND_CAP_EXCEEDED`.",
            "x-martini-error-codes": [
              "INSUFFICIENT_OLIVES",
              "SPEND_CAP_EXCEEDED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_ORGANIZATION_MISMATCH`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `PROJECT_ACCESS_DENIED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_ORGANIZATION_MISMATCH",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "PROJECT_ACCESS_DENIED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `CANVAS_NOT_FOUND`, `ENDPOINT_NOT_REGISTERED`.",
            "x-martini-error-codes": [
              "CANVAS_NOT_FOUND",
              "ENDPOINT_NOT_REGISTERED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `BYOK_KEY_PAUSED`, `BYOK_MISCONFIGURED`, `BYOK_REQUIRED`, `FAL_KEY_REQUIRED`, `PROCESSING_LIMIT_REACHED`, `PROJECT_DOCUMENT_TOO_LARGE`, `REQUEST_ALREADY_TERMINAL`, `SEEDANCE_DRAFT_KEY_MISMATCH`.",
            "x-martini-error-codes": [
              "BYOK_KEY_PAUSED",
              "BYOK_MISCONFIGURED",
              "BYOK_REQUIRED",
              "FAL_KEY_REQUIRED",
              "PROCESSING_LIMIT_REACHED",
              "PROJECT_DOCUMENT_TOO_LARGE",
              "REQUEST_ALREADY_TERMINAL",
              "SEEDANCE_DRAFT_KEY_MISMATCH"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error. `code` is one of: `INVALID_INPUT`, `INVALID_MEDIA`, `MEDIA_TOO_LARGE`, `UNSUPPORTED_INPUT`.",
            "x-martini-error-codes": [
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MEDIA_TOO_LARGE",
              "UNSUPPORTED_INPUT"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `GENERATION_SUBMISSION_FAILED`.",
            "x-martini-error-codes": [
              "GENERATION_SUBMISSION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BYOK_VAULT_UNAVAILABLE`, `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BYOK_VAULT_UNAVAILABLE",
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "generations:write"
      }
    },
    "/v1/generations/{id}": {
      "get": {
        "operationId": "getGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Generation status and output",
        "description": "The generation. `output` is present once `status` is `completed`; `error` once it is `failed` or `cancelled`. A `draft` never settles until POST /v1/generations/{id}/generate starts it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The generation id from POST /v1/generations.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `REQUEST_NOT_FOUND`.",
            "x-martini-error-codes": [
              "REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "generations:read"
      }
    },
    "/v1/generations/{id}/cancel": {
      "post": {
        "operationId": "cancelGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Cancel a generation",
        "description": "Cancel a queued or running generation and refund its charge. Idempotent for an already cancelled one.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The generation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `REQUEST_NOT_FOUND`.",
            "x-martini-error-codes": [
              "REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `REQUEST_ALREADY_TERMINAL`.",
            "x-martini-error-codes": [
              "REQUEST_ALREADY_TERMINAL"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "generations:write"
      }
    },
    "/v1/generations/{id}/generate": {
      "post": {
        "operationId": "startDraftGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Start a draft",
        "description": "Start a draft created with `mode: \"draft\"`, using its latest settings from the Martini canvas.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The draft generation id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The generation, now `pending`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`, `UNSUPPORTED_MARTINI_MODE`, `WEBHOOKS_UNSUPPORTED`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION",
              "UNSUPPORTED_MARTINI_MODE",
              "WEBHOOKS_UNSUPPORTED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error. `code` is one of: `INSUFFICIENT_OLIVES`, `SPEND_CAP_EXCEEDED`.",
            "x-martini-error-codes": [
              "INSUFFICIENT_OLIVES",
              "SPEND_CAP_EXCEEDED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `BILLING_ORGANIZATION_MISMATCH`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `PROJECT_ACCESS_DENIED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "BILLING_ORGANIZATION_MISMATCH",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "PROJECT_ACCESS_DENIED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `CANVAS_NOT_FOUND`, `ENDPOINT_NOT_REGISTERED`, `REQUEST_NOT_FOUND`.",
            "x-martini-error-codes": [
              "CANVAS_NOT_FOUND",
              "ENDPOINT_NOT_REGISTERED",
              "REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `BYOK_KEY_PAUSED`, `BYOK_MISCONFIGURED`, `BYOK_REQUIRED`, `DRAFT_ALREADY_GENERATING`, `FAL_KEY_REQUIRED`, `PROCESSING_LIMIT_REACHED`, `PROJECT_DOCUMENT_TOO_LARGE`, `REQUEST_ALREADY_TERMINAL`, `SEEDANCE_DRAFT_KEY_MISMATCH`.",
            "x-martini-error-codes": [
              "BYOK_KEY_PAUSED",
              "BYOK_MISCONFIGURED",
              "BYOK_REQUIRED",
              "DRAFT_ALREADY_GENERATING",
              "FAL_KEY_REQUIRED",
              "PROCESSING_LIMIT_REACHED",
              "PROJECT_DOCUMENT_TOO_LARGE",
              "REQUEST_ALREADY_TERMINAL",
              "SEEDANCE_DRAFT_KEY_MISMATCH"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error. `code` is one of: `INVALID_INPUT`, `INVALID_MEDIA`, `MEDIA_TOO_LARGE`, `UNSUPPORTED_INPUT`.",
            "x-martini-error-codes": [
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MEDIA_TOO_LARGE",
              "UNSUPPORTED_INPUT"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `GENERATION_SUBMISSION_FAILED`.",
            "x-martini-error-codes": [
              "GENERATION_SUBMISSION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `BYOK_VAULT_UNAVAILABLE`, `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "BYOK_VAULT_UNAVAILABLE",
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "generations:write"
      }
    },
    "/v1/workflows/version-labels": {
      "get": {
        "operationId": "listWorkflowVersionLabels",
        "tags": [
          "Workflows"
        ],
        "summary": "List workspace labels",
        "parameters": [
          {
            "name": "orgId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowVersionLabels"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      },
      "post": {
        "operationId": "createWorkflowVersionLabel",
        "tags": [
          "Workflows"
        ],
        "summary": "Create a workspace label",
        "parameters": [],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "requestBody": {
          "required": true,
          "description": "Label metadata.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowVersionLabel"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowVersionLabelResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/version-labels/{labelId}": {
      "delete": {
        "operationId": "deleteWorkflowVersionLabel",
        "tags": [
          "Workflows"
        ],
        "summary": "Delete an unused workspace label; assigned labels return 409",
        "parameters": [
          {
            "name": "labelId",
            "in": "path",
            "required": true,
            "description": "Label UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowLabelAssigned"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      },
      "patch": {
        "operationId": "setWorkflowVersionLabelColor",
        "tags": [
          "Workflows"
        ],
        "summary": "Edit a workspace label color",
        "parameters": [
          {
            "name": "labelId",
            "in": "path",
            "required": true,
            "description": "Label UUID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "requestBody": {
          "required": true,
          "description": "Label metadata.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkflowVersionLabel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowVersionLabelResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/{workflowId}/revision-labels": {
      "get": {
        "operationId": "getWorkflowRevisionLabels",
        "tags": [
          "Workflows"
        ],
        "summary": "Read labels for saved versions",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Saved workflow UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionIds",
            "in": "query",
            "required": true,
            "description": "1–100 comma-separated revision UUIDs from this workflow; empty entries are included in the result.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevisionLabels"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/workflows/{workflowId}/revisions/{revisionId}/labels/{labelId}": {
      "put": {
        "operationId": "assignWorkflowRevisionLabel",
        "tags": [
          "Workflows"
        ],
        "summary": "Assign a label to a version",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "labelId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowLabelAssigned"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      },
      "delete": {
        "operationId": "removeWorkflowRevisionLabel",
        "tags": [
          "Workflows"
        ],
        "summary": "Remove a label from a version",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "labelId",
            "in": "path",
            "required": true,
            "description": "Permanent UUID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Workspace labels are mutable metadata, never execution selectors. Requires workflows:read for reads and workflows:write for mutations, plus workspace access. Scoped keys cannot cross organizations. Limits: 100 labels per workspace, 20 per version; case-insensitive unique names. Assignment and removal are idempotent.",
        "responses": {
          "200": {
            "description": "Label result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowLabelAssigned"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Invalid input, inaccessible workspace/version/label, duplicate name, quota, or service failure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/{workflowId}/lineage": {
      "get": {
        "operationId": "getWorkflowLineage",
        "tags": [
          "Workflows"
        ],
        "summary": "Read a bounded, permission-checked workflow lineage graph",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowLineage"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Latest limit history nodes, their exact parents, and up to limit immediate external-child candidates: at most 3*limit revisions. No definitions or computed fingerprints. Only actual parentRevisionId edges define ancestry. Related workspaces require access (scoped keys stay in their organization). Inaccessible parent descriptors are null; their opaque parentRevisionId is retained. Permission filtering does not refill bounded windows. truncated is true if history or the child candidate window exceeded limit. Follow related workflow IDs for deeper traversal.",
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/workflows/{workflowId}/revisions": {
      "get": {
        "operationId": "listWorkflowRevisions",
        "tags": [
          "Workflows"
        ],
        "summary": "List immutable versions, newest first",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "beforeVersion",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevisionList"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      },
      "post": {
        "operationId": "saveWorkflowRevision",
        "tags": [
          "Workflows"
        ],
        "summary": "Commit a full definition as an immutable version; never promotes production. Name-only definition changes return 400 WORKFLOW_REVISION_METADATA_ONLY without mutation; use PATCH /workflows/saved/:id for metadata updates. Accepted replay is checked first. Unchanged definitions and bump-only saves remain allowed",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id. Legacy workflow groups do not define revision identity.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Version operation. Keyed retries must use the same payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWorkflowRevision"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevisionWrite"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`, `INVALID_WORKFLOW_REVISION`, `WORKFLOW_REVISION_METADATA_ONLY`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION",
              "INVALID_WORKFLOW_REVISION",
              "WORKFLOW_REVISION_METADATA_ONLY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/{workflowId}/revisions/{revisionId}": {
      "get": {
        "operationId": "getWorkflowRevision",
        "tags": [
          "Workflows"
        ],
        "summary": "Read an exact immutable version with permission-checked ancestry",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revisionId",
            "in": "path",
            "required": true,
            "description": "Permanent revision id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevision"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/workflows/{workflowId}/compare": {
      "get": {
        "operationId": "compareWorkflowRevisions",
        "tags": [
          "Workflows"
        ],
        "summary": "Compare exact version definitions, files and tool references",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromRevisionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "toRevisionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevisionComparison"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/workflows/{workflowId}/fork": {
      "post": {
        "operationId": "forkWorkflowRevision",
        "tags": [
          "Workflows"
        ],
        "summary": "Fork an exact version into a new stable identity starting at 1.0.0",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id. Legacy workflow groups do not define revision identity.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Version operation. Keyed retries must use the same payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForkWorkflowRevision"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRevisionWrite"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/{workflowId}/production": {
      "get": {
        "operationId": "getWorkflowProduction",
        "tags": [
          "Workflows"
        ],
        "summary": "Read the production pointer, generation and append-only audit",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id. Legacy workflow groups do not define revision identity.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowProduction"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      },
      "post": {
        "operationId": "setWorkflowProduction",
        "tags": [
          "Workflows"
        ],
        "summary": "Enable, promote, roll back or disable production with expected-current guards",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "Stable saved workflow id. Legacy workflow groups do not define revision identity.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Version operation. Keyed retries must use the same payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetWorkflowProduction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The version operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowProduction"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_WORKFLOW_REVISION`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_WORKFLOW_REVISION",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOW_FORK_FORBIDDEN`, `WORKFLOW_WRITE_FORBIDDEN`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_WRITE_FORBIDDEN"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_IDEMPOTENCY_CONFLICT`, `WORKFLOW_NAME_TAKEN`, `WORKFLOW_PRODUCTION_CONFLICT`, `WORKFLOW_PRODUCTION_NOT_SET`, `WORKFLOW_RELEASE_MODE_CONFLICT`, `WORKFLOW_REVISION_CONFLICT`, `WORKFLOW_TOOL_BUNDLE_CHANGED`.",
            "x-martini-error-codes": [
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_TOOL_BUNDLE_CHANGED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_REVISION_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_REVISION_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "tags": [
          "Workflows"
        ],
        "summary": "List workflows",
        "description": "Saved workflows (the workspace’s reusable machinery). With `all=true`, also the placed workflows the key’s user can run in place.",
        "parameters": [
          {
            "name": "all",
            "in": "query",
            "required": false,
            "description": "Include placed workflows.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The workflows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowList"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      },
      "post": {
        "operationId": "createWorkflow",
        "tags": [
          "Workflows"
        ],
        "summary": "Place a copy of a saved workflow",
        "description": "Advanced: place a copy of a saved workflow on a canvas of your choosing, to edit before running.",
        "requestBody": {
          "required": true,
          "description": "Which saved workflow to place, and where.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflow"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The placed workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlacedWorkflow"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_FILE_INPUT`, `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_FILE_INPUT",
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `PROJECT_WRITE_FORBIDDEN`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "PROJECT_WRITE_FORBIDDEN",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `INVALID_FILE_INPUT`, `PROJECT_NOT_FOUND`, `WORKFLOW_NOT_FOUND`.",
            "x-martini-error-codes": [
              "INVALID_FILE_INPUT",
              "PROJECT_NOT_FOUND",
              "WORKFLOW_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_FILE_SNAPSHOT_CONFLICT`.",
            "x-martini-error-codes": [
              "WORKFLOW_FILE_SNAPSHOT_CONFLICT"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error. `code` is one of: `WORKFLOW_CREATE_REJECTED`.",
            "x-martini-error-codes": [
              "WORKFLOW_CREATE_REJECTED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_CREATE_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_CREATE_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/workflows/{workflowId}": {
      "get": {
        "operationId": "getWorkflow",
        "tags": [
          "Workflows"
        ],
        "summary": "One workflow",
        "description": "A saved or placed workflow, with the variables and input bins a run accepts.",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "A saved or placed workflow id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workflow"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/workflows/{workflowId}/runs": {
      "post": {
        "operationId": "createRun",
        "tags": [
          "Workflows"
        ],
        "summary": "Start a run",
        "description": "Run a saved workflow using its exact `revisionId`, explicit `production: true`, or default selection (current head in legacy mode; production in managed mode), resolving once and retaining its immutable snapshot. A keyed retry returns the original run even after production moves. Run a saved workflow using its saved definition and presets on a fresh canvas, or a placed workflow in place using its canvas state. Omitted bins keep their defaults; explicit `bins` replace them. Only saved bins marked `required` need caller input. `projectId` selects the destination only; omit it to use Workflow runs. Do not choose a placed copy to recover a saved workflow’s presets. Pin variable values by name or the selected workflow’s own input ids. A bin entry may also be a public https:// URL, a data: URI, or `{ url, filename }`: Martini imports those files before the run starts and answers 400 `WORKFLOW_INPUT_FETCH_FAILED` (naming the bin and URL) without starting the run when one cannot be fetched or processed. Answers 201 with the run; poll GET /v1/runs/{runId}, and fetch GET /v1/runs/{runId}/results for the outputs settled so far or once it settles. Runs started here auto-approve.",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "description": "A saved or placed workflow id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Per-run inputs and options. An empty object is valid for a placed workflow.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRun"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The run, `pending`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRun"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_FILE_INPUT`, `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`, `WORKFLOW_ASSET_NOT_FOUND`, `WORKFLOW_BIN_NOT_FOUND`, `WORKFLOW_BIN_REQUIRED`, `WORKFLOW_INPUT_FETCH_FAILED`, `WORKFLOW_VARIABLE_NOT_FOUND`.",
            "x-martini-error-codes": [
              "INVALID_FILE_INPUT",
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION",
              "WORKFLOW_ASSET_NOT_FOUND",
              "WORKFLOW_BIN_NOT_FOUND",
              "WORKFLOW_BIN_REQUIRED",
              "WORKFLOW_INPUT_FETCH_FAILED",
              "WORKFLOW_VARIABLE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `PROJECT_WRITE_FORBIDDEN`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "PROJECT_WRITE_FORBIDDEN",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `INVALID_FILE_INPUT`, `PROJECT_NOT_FOUND`, `WORKFLOW_NOT_FOUND`.",
            "x-martini-error-codes": [
              "INVALID_FILE_INPUT",
              "PROJECT_NOT_FOUND",
              "WORKFLOW_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `INVALID_FILE_INPUT`, `KIT_STALE`, `WORKFLOW_CHANGED`, `WORKFLOW_FILE_SNAPSHOT_CONFLICT`.",
            "x-martini-error-codes": [
              "INVALID_FILE_INPUT",
              "KIT_STALE",
              "WORKFLOW_CHANGED",
              "WORKFLOW_FILE_SNAPSHOT_CONFLICT"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_REJECTED`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_REJECTED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/runs/{runId}": {
      "get": {
        "operationId": "getRun",
        "tags": [
          "Workflows"
        ],
        "summary": "Run status",
        "description": "The run with per-step and per-take progress and the live `phase` line. Poll until `status` is completed, failed, or cancelled — with `?wait=45`, each call holds until the run changes instead of answering at once; `?include=activity` adds each step's `events` (its activity trail).",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "`activity` adds each step's `events`. Any other value answers 400 INVALID_REQUEST.",
            "schema": {
              "type": "string",
              "enum": [
                "activity"
              ]
            }
          },
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Long-poll: hold the call up to this many seconds (0–45) until the run changes — its status, its current step, its phase line, its progress, or its outputs — or settles (completed, failed, needs_revision, cancelled), then answer. A settled run answers at once, and so does every call when the server is holding too many polls; when nothing changed in time the answer is the run as it stands. Replaces sleeping between polls: call again with the same `wait` until `status` is terminal. Any other value answers 400 INVALID_REQUEST.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 45,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRun"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/runs/{runId}/status": {
      "get": {
        "operationId": "getRunStatus",
        "tags": [
          "Workflows"
        ],
        "summary": "Compact run status",
        "description": "Durable activity, executor model, per-unit model steps, output counts and budget. Excludes definitions, input payloads, individual takes and diagnostic traces. Progress is the last observed work; lifecycle status is authoritative when paused or terminal. Planned outputs are not a required-shot ledger. `?wait=` holds the call until the run changes, as on GET /v1/runs/{runId}.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Long-poll: hold the call up to this many seconds (0–45) until the run changes — its status, its current step, its phase line, its progress, or its outputs — or settles (completed, failed, needs_revision, cancelled), then answer. A settled run answers at once, and so does every call when the server is holding too many polls; when nothing changed in time the answer is the run as it stands. Replaces sleeping between polls: call again with the same `wait` until `status` is terminal. Any other value answers 400 INVALID_REQUEST.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 45,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Compact run status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunStatus"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/runs/{runId}/resume": {
      "post": {
        "operationId": "resumeRun",
        "tags": [
          "Workflows"
        ],
        "summary": "Resume a failed run",
        "description": "Retry the failed Action of a `failed` run with the same inputs; finished Actions and finished units keep their outputs, and the olives already spent are not charged again. A run that failed because an Action needs revision fails the same way when resumed unchanged: change the inputs and start a new run instead. Answers 200 with the run, `pending` again; poll GET /v1/runs/{runId}.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The run, pending again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRun"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_NOT_RESUMABLE`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_NOT_RESUMABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_FAILED`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:write"
      }
    },
    "/v1/runs/{runId}/results": {
      "get": {
        "operationId": "getRunResults",
        "tags": [
          "Workflows"
        ],
        "summary": "Run outputs",
        "description": "Output files with presigned download URLs, valid for `expiresIn` seconds — fetch them promptly. Answers at any time with the takes settled so far; `status` says whether more may come. Text notes a step writes as outputs are not files and are not listed. Call it when a status poll shows a new completed item, not on every poll.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The outputs settled so far.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowResults"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `WORKFLOWS_NOT_ENABLED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "WORKFLOWS_NOT_ENABLED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `WORKFLOW_RUN_NOT_FOUND`.",
            "x-martini-error-codes": [
              "WORKFLOW_RUN_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/assets/uploads/prepare": {
      "post": {
        "operationId": "prepareAssetUploads",
        "tags": [
          "Assets"
        ],
        "summary": "Prepare direct uploads",
        "description": "Step 1 of 3. Creates placeholder assets and returns a presigned PUT URL per file (PUT the bytes there with the returned headers, no Martini headers), then call /assets/uploads/complete. Up to 50 files. Images up to 10 MB, MP3/WAV up to 15 MB, MP4 up to 200 MB in one PUT. For a larger video (up to 2 GiB), or any file you want to send in retryable pieces, set `multipart: true` on the file: from 16 MiB the result then carries a `multipart` plan (`uploadUrl` is null) instead of a single URL. PUT part n, bytes `(n-1) * partSize` up to `min(n * partSize, sizeBytes)`, to its URL with no extra headers, keep each response’s `ETag` header (quotes included), and send them to complete. A video over 200 MB without `multipart` is refused with MULTIPART_REQUIRED.",
        "requestBody": {
          "required": true,
          "description": "The files to upload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per file, in order; check `ok` on each.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrepareUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BATCH_EMPTY`, `BATCH_TOO_LARGE`, `BILLING_ORGANIZATION_MISMATCH`, `CANVAS_NOT_FOUND`, `DUPLICATE_ASSET_ID`, `INVALID_DESTINATION`, `INVALID_FILENAME`, `INVALID_FORMAT`, `INVALID_INPUT`, `INVALID_MEDIA`, `MULTIPART_ASSET_NOT_LISTED`, `PLACEMENT_CONFLICT`, `PROJECT_ACCESS_DENIED`, `SIZE_EXCEEDED`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BATCH_EMPTY",
              "BATCH_TOO_LARGE",
              "BILLING_ORGANIZATION_MISMATCH",
              "CANVAS_NOT_FOUND",
              "DUPLICATE_ASSET_ID",
              "INVALID_DESTINATION",
              "INVALID_FILENAME",
              "INVALID_FORMAT",
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MULTIPART_ASSET_NOT_LISTED",
              "PLACEMENT_CONFLICT",
              "PROJECT_ACCESS_DENIED",
              "SIZE_EXCEEDED",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error. `code` is one of: `BODY_TOO_LARGE`.",
            "x-martini-error-codes": [
              "BODY_TOO_LARGE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `ASSET_UPLOAD_FAILED`.",
            "x-martini-error-codes": [
              "ASSET_UPLOAD_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "assets:write"
      }
    },
    "/assets/uploads/complete": {
      "post": {
        "operationId": "completeAssetUploads",
        "tags": [
          "Assets"
        ],
        "summary": "Complete direct uploads",
        "description": "Step 3 of 3. Verifies the uploaded objects and queues processing. For a file sent in parts, include a `multipart` entry (the plan’s `uploadToken` and every part’s `partNumber` and `etag`); a retryable MULTIPART_INVALID_PARTS or MULTIPART_COMPLETE_FAILED leaves the asset uploading, so fix the list and call again. Then poll GET /assets/{assetId} until `status` is completed; its `url` is durable and usable in generation media fields.",
        "requestBody": {
          "required": true,
          "description": "The asset ids from prepare.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per asset id, in order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BATCH_EMPTY`, `BATCH_TOO_LARGE`, `BILLING_ORGANIZATION_MISMATCH`, `CANVAS_NOT_FOUND`, `DUPLICATE_ASSET_ID`, `INVALID_DESTINATION`, `INVALID_FILENAME`, `INVALID_FORMAT`, `INVALID_INPUT`, `INVALID_MEDIA`, `MULTIPART_ASSET_NOT_LISTED`, `PLACEMENT_CONFLICT`, `PROJECT_ACCESS_DENIED`, `SIZE_EXCEEDED`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BATCH_EMPTY",
              "BATCH_TOO_LARGE",
              "BILLING_ORGANIZATION_MISMATCH",
              "CANVAS_NOT_FOUND",
              "DUPLICATE_ASSET_ID",
              "INVALID_DESTINATION",
              "INVALID_FILENAME",
              "INVALID_FORMAT",
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MULTIPART_ASSET_NOT_LISTED",
              "PLACEMENT_CONFLICT",
              "PROJECT_ACCESS_DENIED",
              "SIZE_EXCEEDED",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error. `code` is one of: `BODY_TOO_LARGE`.",
            "x-martini-error-codes": [
              "BODY_TOO_LARGE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `ASSET_UPLOAD_FAILED`.",
            "x-martini-error-codes": [
              "ASSET_UPLOAD_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "assets:write"
      }
    },
    "/assets/uploads/abort": {
      "post": {
        "operationId": "abortAssetUploads",
        "tags": [
          "Assets"
        ],
        "summary": "Abort direct uploads",
        "description": "Gives up on uploads in flight: discards the uploaded parts (pass the plan’s `uploadToken`) and marks the placeholder failed so it stops counting against the key’s upload capacity. Call it after a part failed every retry, never while a completion may still be running. An asset that already finished is refused with ALREADY_PROCESSED.",
        "requestBody": {
          "required": true,
          "description": "The assets to abort, with their plan tokens.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AbortUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per upload, in order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbortUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BATCH_EMPTY`, `BATCH_TOO_LARGE`, `BILLING_ORGANIZATION_MISMATCH`, `CANVAS_NOT_FOUND`, `DUPLICATE_ASSET_ID`, `INVALID_DESTINATION`, `INVALID_FILENAME`, `INVALID_FORMAT`, `INVALID_INPUT`, `INVALID_MEDIA`, `MULTIPART_ASSET_NOT_LISTED`, `PLACEMENT_CONFLICT`, `PROJECT_ACCESS_DENIED`, `SIZE_EXCEEDED`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BATCH_EMPTY",
              "BATCH_TOO_LARGE",
              "BILLING_ORGANIZATION_MISMATCH",
              "CANVAS_NOT_FOUND",
              "DUPLICATE_ASSET_ID",
              "INVALID_DESTINATION",
              "INVALID_FILENAME",
              "INVALID_FORMAT",
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MULTIPART_ASSET_NOT_LISTED",
              "PLACEMENT_CONFLICT",
              "PROJECT_ACCESS_DENIED",
              "SIZE_EXCEEDED",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error. `code` is one of: `BODY_TOO_LARGE`.",
            "x-martini-error-codes": [
              "BODY_TOO_LARGE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `ASSET_UPLOAD_FAILED`.",
            "x-martini-error-codes": [
              "ASSET_UPLOAD_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "assets:write"
      }
    },
    "/assets/uploads/base64": {
      "post": {
        "operationId": "uploadAssetBase64",
        "tags": [
          "Assets"
        ],
        "summary": "Upload one small file through the API",
        "description": "The alternative to direct upload when storage is unreachable from your environment. Smaller caps (10 MB image, 30 MB MP4, 15 MB MP3/WAV, decoded); prefer the prepare/complete flow. The bytes are stored by this call: `prepare` reports the placement only (no `uploadUrl`), and `asset` is the completed upload — poll GET /assets/{assetId} until `status` is completed.",
        "requestBody": {
          "required": true,
          "description": "The file, base64-encoded.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Base64UploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created asset and its placement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Base64UploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `BATCH_EMPTY`, `BATCH_TOO_LARGE`, `BILLING_ORGANIZATION_MISMATCH`, `CANVAS_NOT_FOUND`, `DUPLICATE_ASSET_ID`, `INVALID_DESTINATION`, `INVALID_FILENAME`, `INVALID_FORMAT`, `INVALID_INPUT`, `INVALID_MEDIA`, `MULTIPART_ASSET_NOT_LISTED`, `PLACEMENT_CONFLICT`, `PROJECT_ACCESS_DENIED`, `SIZE_EXCEEDED`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "BATCH_EMPTY",
              "BATCH_TOO_LARGE",
              "BILLING_ORGANIZATION_MISMATCH",
              "CANVAS_NOT_FOUND",
              "DUPLICATE_ASSET_ID",
              "INVALID_DESTINATION",
              "INVALID_FILENAME",
              "INVALID_FORMAT",
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "MULTIPART_ASSET_NOT_LISTED",
              "PLACEMENT_CONFLICT",
              "PROJECT_ACCESS_DENIED",
              "SIZE_EXCEEDED",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error. `code` is one of: `BODY_TOO_LARGE`.",
            "x-martini-error-codes": [
              "BODY_TOO_LARGE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `ASSET_UPLOAD_FAILED`.",
            "x-martini-error-codes": [
              "ASSET_UPLOAD_FAILED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "assets:write"
      }
    },
    "/assets/{assetId}": {
      "get": {
        "operationId": "getAsset",
        "tags": [
          "Assets"
        ],
        "summary": "Asset status",
        "description": "The asset and its processing state. Poll until `status` is completed or failed.",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "The asset id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectId",
            "in": "query",
            "required": false,
            "description": "The project the asset belongs to; defaults to the key’s default project.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The asset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Asset"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `GENERATION_API_DISABLED`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "GENERATION_API_DISABLED",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `ASSET_NOT_FOUND`.",
            "x-martini-error-codes": [
              "ASSET_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error. `code` is one of: `GENERATION_API_ACCESS_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "GENERATION_API_ACCESS_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "assets:read"
      }
    },
    "/v1/tools": {
      "get": {
        "operationId": "listTools",
        "tags": [
          "Tools"
        ],
        "summary": "Tool manifest",
        "description": "Every tool this key can invoke — the registrations the Martini MCP server serves, read back through the protocol — with the JSON Schema of its arguments and its annotations. Tools that need workflows (Actions) access are listed only when the key’s user has it, as on the MCP; a run key is served the whole list. Without a key it answers the tools every account can invoke (no Actions tools), so what is possible can be read before signing up; a key that is sent is checked, so a bad one answers 401. Generate commands or typed wrappers from it; invoke any entry with POST /v1/tools/{name}. The response carries an ETag equal to `hash`, the hash of the list served; send it as If-None-Match to get 304 while that list is unchanged. Every key can call this; the generation-API grant is not required.",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "The `ETag` of a copy already held (the quoted `hash`). When it equals the current one, the answer is 304 with no body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The manifest.",
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "The quoted `hash` of the list served to this key; send it as If-None-Match to get 304 while it is unchanged.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolManifest"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged: the If-None-Match value equals the current `hash` of the list served to this key; no body.",
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `INVALID_API_KEY`, `API_KEY_REVOKED`, `API_KEY_EXPIRED`.",
            "x-martini-error-codes": [
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "workflows:read"
      }
    },
    "/v1/tools/{name}": {
      "post": {
        "operationId": "invokeTool",
        "tags": [
          "Tools"
        ],
        "summary": "Invoke a tool",
        "description": "Run one MCP tool as the key’s user. The body is the tool’s arguments exactly as its `inputSchema` describes them (an empty body means no arguments); the response is the tool’s result with the MCP envelope removed — the JSON object the tool produced, or `{ ..., \"media\": [{ \"type\", \"mimeType\", \"data\" }] }` when it returned an image or audio block (base64 in `data`). `select` keeps only the listed dotted paths, through arrays (`nodes.id`) and, with an explicit `*` segment, every value of an id-keyed map (`assets.*.id`), so large listings never leave the server when a few fields are wanted. `format=raw` answers the bytes of a single media result with its own Content-Type and the JSON metadata in the X-Martini-Tool-Result header. `format=blocks` answers `{ \"blocks\": [...] }`, the MCP content blocks in the tool’s order with nothing unwrapped or merged — text verbatim, image and audio with base64 `data`, or only their decoded `byteLength` with `media=stub` — so a batch result such as `inspect_video` on several assets keeps each asset’s text beside its contact sheet. Tool errors keep their MCP error code in `code`, with the status the code implies. Tools that need workflows (Actions) access answer TOOL_NOT_FOUND for callers without it, as the MCP does. The permission is the tool’s (`x-martini-permission: by-operation`): a tool whose `annotations.readOnlyHint` is true needs `workflows:read`, any other tool `workflows:write`, and `get_balance` needs none; a key without it answers 403 API_KEY_PERMISSION_MISSING naming the one required. A run key (`mtn_run_…`, minted for a workflow run’s sandbox) dispatches through that run’s live supervisor — same budgets, fences, and traces as the run’s own tool calls — and answers RUN_NOT_ACTIVE once the run stops.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "The tool name, as `GET /v1/tools` lists it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "select",
            "in": "query",
            "required": false,
            "description": "Comma-separated dotted field paths to keep in the JSON result (segments of letters, digits, `_`, `-`, or a lone `*`; at most 64). Arrays are traversed element-wise; a `*` segment fans out over every value of an object (keys kept) or every element of an array, e.g. `assets.*.id` on an id-keyed map. Paths that match nothing are dropped.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "`json` (default) answers JSON; `raw` answers the bytes of a result that is exactly one media block, or NOT_RAW_ELIGIBLE; `blocks` answers the tool’s content blocks in order as ToolResultBlocks, which keeps a batch result’s texts paired with their images. `select` with `blocks` answers INVALID_REQUEST.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "raw",
                "blocks"
              ],
              "default": "json"
            }
          },
          {
            "name": "media",
            "in": "query",
            "required": false,
            "description": "With `format=blocks` only; with any other format it answers INVALID_REQUEST. `inline` (default) carries each image or audio block’s bytes as base64 `data`; `stub` replaces them with `byteLength`, their decoded size, to read a result’s structure without its bytes.",
            "schema": {
              "type": "string",
              "enum": [
                "inline",
                "stub"
              ],
              "default": "inline"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "description": "The tool arguments, matching the tool’s `inputSchema` from GET /v1/tools.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result: its JSON object (projected by `select` when given); with `format=blocks`, its content blocks in order; with `format=raw`, the raw media bytes.",
            "headers": {
              "X-Martini-Tool": {
                "description": "The tool that answered.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Martini-Tool-Result": {
                "description": "With `format=raw`: the JSON metadata that accompanied the media.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "description": "With `format=json` (the default): the tool’s own result shape; see the tool’s description in the manifest."
                    },
                    {
                      "$ref": "#/components/schemas/ToolResultBlocks"
                    }
                  ]
                }
              },
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_ARGUMENTS`, `INVALID_REQUEST`, `TOOL_ERROR`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_ARGUMENTS",
              "INVALID_REQUEST",
              "TOOL_ERROR",
              "UNSUPPORTED_API_VERSION"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "402": {
            "description": "Error. `code` is one of: `TOOL_ERROR`.",
            "x-martini-error-codes": [
              "TOOL_ERROR"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `API_KEY_PERMISSION_MISSING`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`, `TOOL_ERROR`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_PERMISSION_MISSING",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED",
              "TOOL_ERROR"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `TOOL_ERROR`, `TOOL_NOT_FOUND`.",
            "x-martini-error-codes": [
              "TOOL_ERROR",
              "TOOL_NOT_FOUND"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "406": {
            "description": "Error. `code` is one of: `NOT_RAW_ELIGIBLE`.",
            "x-martini-error-codes": [
              "NOT_RAW_ELIGIBLE"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "409": {
            "description": "Error. `code` is one of: `RUN_NOT_ACTIVE`, `TOOL_ERROR`.",
            "x-martini-error-codes": [
              "RUN_NOT_ACTIVE",
              "TOOL_ERROR"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `TOOL_ERROR`.",
            "x-martini-error-codes": [
              "TOOL_ERROR"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `TOOL_INVOCATION_FAILED`.",
            "x-martini-error-codes": [
              "TOOL_INVOCATION_FAILED"
            ],
            "headers": {
              "X-Martini-Guide-Hash": {
                "description": "The `hash` of the guide `GET /v1/guide?transport=cli` serves now, on every answer once the key is accepted: never on 401, and on a 400 or 403 only when the key check passed and the tool answered (not for UNSUPPORTED_API_VERSION or the key-scope errors). A client that holds an older guide can tell it is stale without a request of its own; the CLI warns once and points at `martini guide`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolError"
                }
              }
            }
          }
        },
        "x-martini-permission": "by-operation"
      }
    },
    "/v1/guide": {
      "get": {
        "operationId": "getGuide",
        "tags": [
          "Tools"
        ],
        "summary": "Operator guide",
        "description": "The rules an agent needs to work in Martini well beyond any one tool’s description — orienting on a board, generating and spending, uploads and lineage, asking for support — exactly as the Martini MCP server sends them at initialize, worded by default for the `martini` CLI (commands and flags in place of tool-call shapes, plus how the CLI itself behaves). One text serves both, so the surfaces cannot drift. Read it once per session beside GET /v1/tools. The response carries an ETag equal to `hash`; send it as If-None-Match to get 304 while the text is unchanged. Every key can call this; the generation-API grant is not required.",
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "The `ETag` of a copy already held (the quoted `hash`). When it equals the current one, the answer is 304 with no body.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transport",
            "in": "query",
            "required": false,
            "description": "`cli` (default): the rules worded for the CLI, with the shell topic. `mcp`: the MCP initialize text of the full profile. Any other value answers INVALID_ARGUMENTS.",
            "schema": {
              "type": "string",
              "enum": [
                "cli",
                "mcp"
              ],
              "default": "cli"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The guide.",
            "headers": {
              "ETag": {
                "description": "The quoted `hash` of the guide; send it as If-None-Match to get 304 while it is unchanged.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guide"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged: the If-None-Match value equals the current `hash` of the guide; no body."
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_ARGUMENTS`, `UNSUPPORTED_API_VERSION`.",
            "x-martini-error-codes": [
              "INVALID_ARGUMENTS",
              "UNSUPPORTED_API_VERSION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error. `code` is one of: `API_KEY_EXPIRED`, `API_KEY_REVOKED`, `INVALID_API_KEY`.",
            "x-martini-error-codes": [
              "API_KEY_EXPIRED",
              "API_KEY_REVOKED",
              "INVALID_API_KEY"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `API_KEY_DEFAULTS_MISSING`, `ORGANIZATION_REQUIRED`, `RUN_KEY_NOT_ALLOWED`.",
            "x-martini-error-codes": [
              "API_KEY_DEFAULTS_MISSING",
              "ORGANIZATION_REQUIRED",
              "RUN_KEY_NOT_ALLOWED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "none"
      }
    },
    "/v1/cli/login": {
      "post": {
        "operationId": "createCliLogin",
        "tags": [
          "Tools"
        ],
        "summary": "Start a CLI login (device-code pairing)",
        "description": "How `martini login` obtains a key without a browser on the same machine. Creates a pairing request and returns a short code plus a poll token. The person opens `verificationUrl` in the signed-in Martini app, types the code, picks an organization or \"as you\" (an account key with no organization), and approves; the CLI polls `GET /v1/cli/login/{pollToken}` until it is handed a fresh `mtn_cli_…` key (90-day expiry). Send `X-Martini-Client: martini-cli/<version>` so the approval page offers only what that CLI can collect. No authentication: the CLI has none yet. Rate limited per client.",
        "security": [],
        "requestBody": {
          "required": true,
          "description": "The device to label the key with.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CliLoginCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The pairing request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliLoginCreated"
                }
              }
            }
          },
          "400": {
            "description": "Error. `code` is one of: `INVALID_REQUEST`, `INVALID_DEVICE_LABEL`.",
            "x-martini-error-codes": [
              "INVALID_REQUEST",
              "INVALID_DEVICE_LABEL"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `LOGIN_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "LOGIN_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "public"
      }
    },
    "/v1/cli/login/{pollToken}": {
      "get": {
        "operationId": "pollCliLogin",
        "tags": [
          "Tools"
        ],
        "summary": "Poll a CLI login",
        "description": "The pairing request’s state. `approved` carries the key exactly once — a later poll answers `claimed`. Wait `interval` seconds between polls; the request expires ten minutes after creation. An approval \"as you\" (an account key) is refused with 403 `CLI_UPDATE_REQUIRED` — before anything is minted, so the approval stands — when the polling `X-Martini-Client` names a CLI too old to hold one.",
        "security": [],
        "parameters": [
          {
            "name": "pollToken",
            "in": "path",
            "required": true,
            "description": "The poll token from POST /v1/cli/login.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The state, with the key when approved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliLoginPoll"
                }
              }
            }
          },
          "403": {
            "description": "Error. `code` is one of: `CLI_UPDATE_REQUIRED`.",
            "x-martini-error-codes": [
              "CLI_UPDATE_REQUIRED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error. `code` is one of: `LOGIN_REQUEST_NOT_FOUND`.",
            "x-martini-error-codes": [
              "LOGIN_REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error. `code` is one of: `RATE_LIMITED`.",
            "x-martini-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error. `code` is one of: `LOGIN_UNAVAILABLE`.",
            "x-martini-error-codes": [
              "LOGIN_UNAVAILABLE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-martini-permission": "public"
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "tags": [
          "Account"
        ],
        "summary": "This document",
        "description": "The OpenAPI 3.1 description of the API-key surface. No authentication required.",
        "security": [],
        "responses": {
          "200": {
            "description": "The document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "x-martini-permission": "public"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Martini API key (`mtn_live_…`). `Authorization: Bearer <key>`; `Authorization: Key <key>` is also accepted. The key must hold the permission the operation names in `x-martini-permission`."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Copy written for a human."
          },
          "code": {
            "type": "string",
            "description": "The stable Martini error code.",
            "enum": [
              "API_KEY_DEFAULTS_MISSING",
              "API_KEY_EXPIRED",
              "API_KEY_PERMISSION_MISSING",
              "API_KEY_REVOKED",
              "ASSET_NOT_FOUND",
              "ASSET_UPLOAD_FAILED",
              "BALANCE_UNAVAILABLE",
              "BATCH_EMPTY",
              "BATCH_TOO_LARGE",
              "BILLING_API_ACCESS_UNAVAILABLE",
              "BILLING_API_NOT_ENABLED",
              "BILLING_ORGANIZATION_MISMATCH",
              "BODY_TOO_LARGE",
              "BUDGET_EXISTS",
              "BUDGET_INVALID",
              "BUDGET_NOT_FOUND",
              "BUDGET_SCOPE_NOT_FOUND",
              "BYOK_KEY_PAUSED",
              "BYOK_MISCONFIGURED",
              "BYOK_REQUIRED",
              "BYOK_VAULT_UNAVAILABLE",
              "CANVAS_NOT_FOUND",
              "CLI_UPDATE_REQUIRED",
              "DRAFT_ALREADY_GENERATING",
              "DUPLICATE_ASSET_ID",
              "ENDPOINT_NOT_REGISTERED",
              "FAL_KEY_REQUIRED",
              "GENERATION_API_ACCESS_UNAVAILABLE",
              "GENERATION_API_DISABLED",
              "GENERATION_SUBMISSION_FAILED",
              "INSUFFICIENT_OLIVES",
              "INVALID_API_KEY",
              "INVALID_ARGUMENTS",
              "INVALID_CURSOR",
              "INVALID_DESTINATION",
              "INVALID_DEVICE_LABEL",
              "INVALID_FILENAME",
              "INVALID_FILE_INPUT",
              "INVALID_FORMAT",
              "INVALID_INPUT",
              "INVALID_MEDIA",
              "INVALID_QUERY",
              "INVALID_REQUEST",
              "INVALID_TARGET_URL",
              "INVALID_WORKFLOW_REVISION",
              "INVOICE_NOT_FOUND",
              "KIT_STALE",
              "LOGIN_REQUEST_NOT_FOUND",
              "LOGIN_UNAVAILABLE",
              "MEDIA_TOO_LARGE",
              "MULTIPART_ASSET_NOT_LISTED",
              "NOT_RAW_ELIGIBLE",
              "ORGANIZATION_NOT_FOUND",
              "ORGANIZATION_REQUIRED",
              "PLACEMENT_CONFLICT",
              "PLACEMENT_FAILED",
              "PROCESSING_LIMIT_REACHED",
              "PROJECT_ACCESS_DENIED",
              "PROJECT_DOCUMENT_TOO_LARGE",
              "PROJECT_DOCUMENT_UNAVAILABLE",
              "PROJECT_NOT_FOUND",
              "PROJECT_WRITE_FORBIDDEN",
              "RATE_LIMITED",
              "REQUEST_ALREADY_TERMINAL",
              "REQUEST_NOT_FOUND",
              "RESULT_NOT_READY",
              "RUN_KEY_NOT_ALLOWED",
              "RUN_NOT_ACTIVE",
              "SEEDANCE_DRAFT_KEY_MISMATCH",
              "SIZE_EXCEEDED",
              "SPEND_CAP_EXCEEDED",
              "TOOL_ERROR",
              "TOOL_INVOCATION_FAILED",
              "TOOL_NOT_FOUND",
              "UNSUPPORTED_API_VERSION",
              "UNSUPPORTED_INPUT",
              "UNSUPPORTED_MARTINI_MODE",
              "UNSUPPORTED_OPERATION",
              "WEBHOOKS_UNSUPPORTED",
              "WORKFLOWS_NOT_ENABLED",
              "WORKFLOW_ASSET_NOT_FOUND",
              "WORKFLOW_BIN_NOT_FOUND",
              "WORKFLOW_BIN_REQUIRED",
              "WORKFLOW_CHANGED",
              "WORKFLOW_CREATE_FAILED",
              "WORKFLOW_CREATE_REJECTED",
              "WORKFLOW_FILE_SNAPSHOT_CONFLICT",
              "WORKFLOW_FORK_FORBIDDEN",
              "WORKFLOW_IDEMPOTENCY_CONFLICT",
              "WORKFLOW_INPUT_FETCH_FAILED",
              "WORKFLOW_NAME_TAKEN",
              "WORKFLOW_NOT_FOUND",
              "WORKFLOW_PRODUCTION_CONFLICT",
              "WORKFLOW_PRODUCTION_NOT_SET",
              "WORKFLOW_RELEASE_MODE_CONFLICT",
              "WORKFLOW_REVISION_CONFLICT",
              "WORKFLOW_REVISION_FAILED",
              "WORKFLOW_REVISION_METADATA_ONLY",
              "WORKFLOW_REVISION_NOT_FOUND",
              "WORKFLOW_RUN_FAILED",
              "WORKFLOW_RUN_NOT_FOUND",
              "WORKFLOW_RUN_NOT_RESUMABLE",
              "WORKFLOW_RUN_REJECTED",
              "WORKFLOW_TOOL_BUNDLE_CHANGED",
              "WORKFLOW_VARIABLE_NOT_FOUND",
              "WORKFLOW_WRITE_FORBIDDEN"
            ]
          },
          "required": {
            "description": "With API_KEY_PERMISSION_MISSING: the permission the operation requires.",
            "type": "string",
            "enum": [
              "generations:read",
              "generations:write",
              "workflows:read",
              "workflows:write",
              "assets:read",
              "assets:write",
              "billing:read",
              "billing:write"
            ]
          },
          "granted": {
            "description": "With API_KEY_PERMISSION_MISSING: the permissions the key holds.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "settingsUrl": {
            "description": "With API_KEY_PERMISSION_MISSING: where a key with the right permission is created.",
            "type": "string"
          }
        },
        "required": [
          "error",
          "code"
        ],
        "additionalProperties": {},
        "description": "Every non-2xx answer. `error` is copy for a human; `code` is the stable value to branch on. API_KEY_PERMISSION_MISSING adds `required`, `granted`, and `settingsUrl`."
      },
      "Me": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "organization",
              "user"
            ],
            "description": "`organization`: the key is bound to `organization`. `user`: an account key from `martini login` approved \"as you\"; it acts wherever its user is a member, on the tool routes only."
          },
          "organization": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The organization the key is bound to; null for an account key."
          },
          "organizations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "slug": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "personal",
                    "team"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "slug",
                "type"
              ],
              "additionalProperties": false
            },
            "description": "For an account key, every organization its user belongs to, personal first. For an organization-bound key, only that organization (empty if the key’s user has since left it). Empty for a workflow run key."
          },
          "key": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "api",
                  "cli",
                  "run"
                ]
              },
              "expiresAt": {
                "description": "When the key expires; null for a key that only ends by revocation.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "permissions": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "generations:read",
                    "generations:write",
                    "workflows:read",
                    "workflows:write",
                    "assets:read",
                    "assets:write",
                    "billing:read",
                    "billing:write"
                  ]
                },
                "description": "What the key may do, as `family:level` (`write` implies `read`). Every operation names the one it requires in `x-martini-permission`; a call without it answers 403 API_KEY_PERMISSION_MISSING. Fixed when the key is created."
              },
              "budget": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "scope": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "organization",
                              "project",
                              "member",
                              "apiKey"
                            ]
                          },
                          "id": {
                            "type": "string",
                            "description": "The project, member, or key id; the organization id for an organization budget."
                          },
                          "name": {
                            "type": "string",
                            "description": "The project name, member alias, or key label; the organization name for an organization budget."
                          }
                        },
                        "required": [
                          "type",
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      "amountOlives": {
                        "type": "number",
                        "description": "The hard limit; a charge that would cross it is refused with 402 before any work starts."
                      },
                      "period": {
                        "type": "string",
                        "enum": [
                          "lifetime",
                          "month"
                        ],
                        "description": "`lifetime`, or the calendar month in UTC."
                      },
                      "alerts": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "atOlives": {
                              "type": "number",
                              "description": "Spend in the period at which to notify; at most `amountOlives`."
                            },
                            "channels": {
                              "minItems": 1,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "const": "email"
                              },
                              "description": "Where to notify; `email` reaches the organization’s admins."
                            }
                          },
                          "required": [
                            "atOlives",
                            "channels"
                          ],
                          "additionalProperties": false,
                          "description": "A soft threshold: notify, never block."
                        }
                      },
                      "status": {
                        "type": "object",
                        "properties": {
                          "spentOlives": {
                            "type": "number",
                            "description": "Settled spend in the current period."
                          },
                          "reservedOlives": {
                            "type": "number",
                            "description": "Admitted but not yet settled spend in the current period."
                          },
                          "remainingOlives": {
                            "type": "number",
                            "description": "`amountOlives` minus spent and reserved, floored at zero."
                          },
                          "periodStart": {
                            "description": "Null for a `lifetime` budget.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "periodEnd": {
                            "description": "Null for a `lifetime` budget.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "blocked": {
                            "type": "boolean",
                            "description": "True when the next charge against this scope would be refused."
                          }
                        },
                        "required": [
                          "spentOlives",
                          "reservedOlives",
                          "remainingOlives",
                          "periodStart",
                          "periodEnd",
                          "blocked"
                        ],
                        "additionalProperties": false
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "updatedAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "scope",
                      "amountOlives",
                      "period",
                      "alerts",
                      "status",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The key’s own spend budget (`POST /v1/billing/budgets` with an `apiKey` scope), with where it stands; null when it has none, and always null for a workflow run key."
              }
            },
            "required": [
              "label",
              "kind",
              "expiresAt",
              "permissions",
              "budget"
            ],
            "additionalProperties": false
          },
          "apiVersion": {
            "type": "string"
          }
        },
        "required": [
          "scope",
          "organization",
          "organizations",
          "key",
          "apiVersion"
        ],
        "additionalProperties": false
      },
      "Balance": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/OrganizationBalance"
          },
          {
            "$ref": "#/components/schemas/RunBalance"
          }
        ],
        "discriminator": {
          "propertyName": "kind"
        }
      },
      "OrganizationBalance": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "organization"
          },
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "billingEnabled": {
            "type": "boolean",
            "description": "False when this deployment has no billing configured: `olives` is null and nothing is charged."
          },
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "description": "The plan the organization is on (`pro`, `studio`, …); null before any plan.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodEnd": {
                "description": "End of the current billing period; null without a subscription.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "status",
              "periodEnd"
            ],
            "additionalProperties": false
          },
          "olives": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "number",
                    "description": "What a new generation or run can spend right now, with active reservation holds netted out."
                  },
                  "granted": {
                    "type": "number",
                    "description": "Everything granted this period: `included` plus `purchased`."
                  },
                  "included": {
                    "type": "number",
                    "description": "The plan’s included allowance for the period."
                  },
                  "purchased": {
                    "type": "number",
                    "description": "Top-ups and other prepaid grants."
                  },
                  "usedThisPeriod": {
                    "type": "number",
                    "description": "Consumed since the period started. For a post-paid organization, whose allowance does not reset, this is the granted consumption plus the unpaid overage, so it falls when an invoice payment is recorded; the month’s consumption is on its statement."
                  },
                  "reserved": {
                    "description": "Olives held by admissions that have not settled yet. Informational: `available` already nets them. Null when this deployment does not record holds.",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "unlimited": {
                    "type": "boolean",
                    "description": "True when the organization’s olives are not metered; `available` then bounds nothing."
                  },
                  "resetsAt": {
                    "description": "When the included allowance resets; null when it does not.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postPaid": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "creditLimit": {
                            "description": "Olives of unpaid overage the organization may run up before charges are refused; null when no line is set.",
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "outstanding": {
                            "type": "number",
                            "description": "Olives consumed beyond the granted balance and not yet settled by an invoice payment."
                          }
                        },
                        "required": [
                          "creditLimit",
                          "outstanding"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The organization’s post-paid terms, or null when it pays up front. Under post-paid `available` is the granted balance plus what the credit line still admits, so the pre-flight comparison is unchanged."
                  }
                },
                "required": [
                  "available",
                  "granted",
                  "included",
                  "purchased",
                  "usedThisPeriod",
                  "reserved",
                  "unlimited",
                  "resetsAt",
                  "postPaid"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "asOf": {
            "type": "string",
            "description": "When the numbers were read from the billing system; at most 10 seconds old."
          }
        },
        "required": [
          "kind",
          "organization",
          "billingEnabled",
          "plan",
          "olives",
          "asOf"
        ],
        "additionalProperties": false
      },
      "RunBalance": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "run"
          },
          "runId": {
            "type": "string"
          },
          "billingEnabled": {
            "type": "boolean",
            "description": "False when this deployment has no billing configured: `covered` is then always true."
          },
          "budget": {
            "type": "object",
            "properties": {
              "olives": {
                "description": "The run’s olive budget; null for an unbudgeted run.",
                "type": [
                  "number",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "explicit",
                  "auto"
                ],
                "description": "Who chose the rail. `explicit`: the caller passed a budget. `auto`: the run started without one and the harness arms the rail at each action’s gate."
              },
              "spent": {
                "type": "number",
                "description": "Generation and agent olives charged to the run so far."
              },
              "remaining": {
                "description": "`olives` minus `spent`, floored at 0; null for an unbudgeted run.",
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "olives",
              "source",
              "spent",
              "remaining"
            ],
            "additionalProperties": false
          },
          "covered": {
            "type": "boolean",
            "description": "Whether the organization’s available olives cover `budget.remaining`. For an unbudgeted run: whether the organization has any olives left to spend. The run never learns the organization’s numbers."
          },
          "asOf": {
            "type": "string",
            "description": "When the organization balance behind `covered` was read; at most 10 seconds old."
          }
        },
        "required": [
          "kind",
          "runId",
          "billingEnabled",
          "budget",
          "covered",
          "asOf"
        ],
        "additionalProperties": false
      },
      "BillingAccount": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "billingEnabled": {
            "type": "boolean",
            "description": "False when this deployment has no billing configured: `olives` is null and nothing is charged."
          },
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "description": "The plan the organization is on (`pro`, `studio`, …); null before any plan.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodEnd": {
                "description": "End of the current billing period; null without a subscription.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "status",
              "periodEnd"
            ],
            "additionalProperties": false
          },
          "olives": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "number",
                    "description": "What a new generation or run can spend right now, with active reservation holds netted out."
                  },
                  "granted": {
                    "type": "number",
                    "description": "Everything granted this period: `included` plus `purchased`."
                  },
                  "included": {
                    "type": "number",
                    "description": "The plan’s included allowance for the period."
                  },
                  "purchased": {
                    "type": "number",
                    "description": "Top-ups and other prepaid grants."
                  },
                  "usedThisPeriod": {
                    "type": "number",
                    "description": "Consumed since the period started. For a post-paid organization, whose allowance does not reset, this is the granted consumption plus the unpaid overage, so it falls when an invoice payment is recorded; the month’s consumption is on its statement."
                  },
                  "reserved": {
                    "description": "Olives held by admissions that have not settled yet. Informational: `available` already nets them. Null when this deployment does not record holds.",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "unlimited": {
                    "type": "boolean",
                    "description": "True when the organization’s olives are not metered; `available` then bounds nothing."
                  },
                  "resetsAt": {
                    "description": "When the included allowance resets; null when it does not.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postPaid": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "creditLimit": {
                            "description": "Olives of unpaid overage the organization may run up before charges are refused; null when no line is set.",
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "outstanding": {
                            "type": "number",
                            "description": "Olives consumed beyond the granted balance and not yet settled by an invoice payment."
                          }
                        },
                        "required": [
                          "creditLimit",
                          "outstanding"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The organization’s post-paid terms, or null when it pays up front. Under post-paid `available` is the granted balance plus what the credit line still admits, so the pre-flight comparison is unchanged."
                  }
                },
                "required": [
                  "available",
                  "granted",
                  "included",
                  "purchased",
                  "usedThisPeriod",
                  "reserved",
                  "unlimited",
                  "resetsAt",
                  "postPaid"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "autoTopUp": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "thresholdOlives": {
                    "type": "number",
                    "description": "Top up when `available` falls below this."
                  },
                  "refillOlives": {
                    "type": "number",
                    "description": "Olives, with at most four decimals."
                  }
                },
                "required": [
                  "enabled",
                  "thresholdOlives",
                  "refillOlives"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Automatic top-up, as configured in the browser; null when off or unavailable."
          },
          "budget": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "scope": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "organization",
                          "project",
                          "member",
                          "apiKey"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "description": "The project, member, or key id; the organization id for an organization budget."
                      },
                      "name": {
                        "type": "string",
                        "description": "The project name, member alias, or key label; the organization name for an organization budget."
                      }
                    },
                    "required": [
                      "type",
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "amountOlives": {
                    "type": "number",
                    "description": "The hard limit; a charge that would cross it is refused with 402 before any work starts."
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "lifetime",
                      "month"
                    ],
                    "description": "`lifetime`, or the calendar month in UTC."
                  },
                  "alerts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "atOlives": {
                          "type": "number",
                          "description": "Spend in the period at which to notify; at most `amountOlives`."
                        },
                        "channels": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "const": "email"
                          },
                          "description": "Where to notify; `email` reaches the organization’s admins."
                        }
                      },
                      "required": [
                        "atOlives",
                        "channels"
                      ],
                      "additionalProperties": false,
                      "description": "A soft threshold: notify, never block."
                    }
                  },
                  "status": {
                    "type": "object",
                    "properties": {
                      "spentOlives": {
                        "type": "number",
                        "description": "Settled spend in the current period."
                      },
                      "reservedOlives": {
                        "type": "number",
                        "description": "Admitted but not yet settled spend in the current period."
                      },
                      "remainingOlives": {
                        "type": "number",
                        "description": "`amountOlives` minus spent and reserved, floored at zero."
                      },
                      "periodStart": {
                        "description": "Null for a `lifetime` budget.",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "periodEnd": {
                        "description": "Null for a `lifetime` budget.",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "blocked": {
                        "type": "boolean",
                        "description": "True when the next charge against this scope would be refused."
                      }
                    },
                    "required": [
                      "spentOlives",
                      "reservedOlives",
                      "remainingOlives",
                      "periodStart",
                      "periodEnd",
                      "blocked"
                    ],
                    "additionalProperties": false
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "updatedAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "scope",
                  "amountOlives",
                  "period",
                  "alerts",
                  "status",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The organization-scope budget, when one exists."
          },
          "oliveValueUsd": {
            "type": "number",
            "description": "The public nominal value of one olive in USD — the one USD figure in the API, so dashboards can convert."
          },
          "asOf": {
            "type": "string",
            "description": "When the numbers were read from the billing system; at most 10 seconds old."
          }
        },
        "required": [
          "organization",
          "billingEnabled",
          "plan",
          "olives",
          "autoTopUp",
          "budget",
          "oliveValueUsd",
          "asOf"
        ],
        "additionalProperties": false
      },
      "Budget": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "scope": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "organization",
                  "project",
                  "member",
                  "apiKey"
                ]
              },
              "id": {
                "type": "string",
                "description": "The project, member, or key id; the organization id for an organization budget."
              },
              "name": {
                "type": "string",
                "description": "The project name, member alias, or key label; the organization name for an organization budget."
              }
            },
            "required": [
              "type",
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "amountOlives": {
            "type": "number",
            "description": "The hard limit; a charge that would cross it is refused with 402 before any work starts."
          },
          "period": {
            "type": "string",
            "enum": [
              "lifetime",
              "month"
            ],
            "description": "`lifetime`, or the calendar month in UTC."
          },
          "alerts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "atOlives": {
                  "type": "number",
                  "description": "Spend in the period at which to notify; at most `amountOlives`."
                },
                "channels": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "const": "email"
                  },
                  "description": "Where to notify; `email` reaches the organization’s admins."
                }
              },
              "required": [
                "atOlives",
                "channels"
              ],
              "additionalProperties": false,
              "description": "A soft threshold: notify, never block."
            }
          },
          "status": {
            "type": "object",
            "properties": {
              "spentOlives": {
                "type": "number",
                "description": "Settled spend in the current period."
              },
              "reservedOlives": {
                "type": "number",
                "description": "Admitted but not yet settled spend in the current period."
              },
              "remainingOlives": {
                "type": "number",
                "description": "`amountOlives` minus spent and reserved, floored at zero."
              },
              "periodStart": {
                "description": "Null for a `lifetime` budget.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "periodEnd": {
                "description": "Null for a `lifetime` budget.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "blocked": {
                "type": "boolean",
                "description": "True when the next charge against this scope would be refused."
              }
            },
            "required": [
              "spentOlives",
              "reservedOlives",
              "remainingOlives",
              "periodStart",
              "periodEnd",
              "blocked"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "scope",
          "amountOlives",
          "period",
          "alerts",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Budgets": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the budgets belong to."
          },
          "budgets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "scope": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "organization",
                        "project",
                        "member",
                        "apiKey"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "The project, member, or key id; the organization id for an organization budget."
                    },
                    "name": {
                      "type": "string",
                      "description": "The project name, member alias, or key label; the organization name for an organization budget."
                    }
                  },
                  "required": [
                    "type",
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "amountOlives": {
                  "type": "number",
                  "description": "The hard limit; a charge that would cross it is refused with 402 before any work starts."
                },
                "period": {
                  "type": "string",
                  "enum": [
                    "lifetime",
                    "month"
                  ],
                  "description": "`lifetime`, or the calendar month in UTC."
                },
                "alerts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "atOlives": {
                        "type": "number",
                        "description": "Spend in the period at which to notify; at most `amountOlives`."
                      },
                      "channels": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "const": "email"
                        },
                        "description": "Where to notify; `email` reaches the organization’s admins."
                      }
                    },
                    "required": [
                      "atOlives",
                      "channels"
                    ],
                    "additionalProperties": false,
                    "description": "A soft threshold: notify, never block."
                  }
                },
                "status": {
                  "type": "object",
                  "properties": {
                    "spentOlives": {
                      "type": "number",
                      "description": "Settled spend in the current period."
                    },
                    "reservedOlives": {
                      "type": "number",
                      "description": "Admitted but not yet settled spend in the current period."
                    },
                    "remainingOlives": {
                      "type": "number",
                      "description": "`amountOlives` minus spent and reserved, floored at zero."
                    },
                    "periodStart": {
                      "description": "Null for a `lifetime` budget.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "periodEnd": {
                      "description": "Null for a `lifetime` budget.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "blocked": {
                      "type": "boolean",
                      "description": "True when the next charge against this scope would be refused."
                    }
                  },
                  "required": [
                    "spentOlives",
                    "reservedOlives",
                    "remainingOlives",
                    "periodStart",
                    "periodEnd",
                    "blocked"
                  ],
                  "additionalProperties": false
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "scope",
                "amountOlives",
                "period",
                "alerts",
                "status",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            },
            "description": "The organization budget first, then the rest newest first."
          }
        },
        "required": [
          "organization",
          "budgets"
        ],
        "additionalProperties": false
      },
      "BudgetCreate": {
        "type": "object",
        "properties": {
          "scope": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "organization"
                  }
                },
                "required": [
                  "type"
                ],
                "description": "The organization as a whole; names no id."
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "project",
                      "member",
                      "apiKey"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "description": "A project of the organization, one of its members (by user id), or one of its API keys."
              }
            ],
            "description": "What the budget caps. One budget per scope: a second answers 409 BUDGET_EXISTS."
          },
          "amountOlives": {
            "type": "number",
            "description": "The hard limit, at least 0 (0 blocks every charge)."
          },
          "period": {
            "type": "string",
            "enum": [
              "lifetime",
              "month"
            ],
            "description": "`lifetime`, or the calendar month in UTC."
          },
          "alerts": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "atOlives": {
                  "type": "number",
                  "description": "Spend in the period at which to notify; at most `amountOlives`."
                },
                "channels": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "const": "email"
                  },
                  "description": "Where to notify; `email` reaches the organization’s admins."
                }
              },
              "required": [
                "atOlives",
                "channels"
              ],
              "description": "A soft threshold: notify, never block."
            },
            "description": "Up to 10; each `atOlives` distinct and at most `amountOlives`."
          }
        },
        "required": [
          "scope",
          "amountOlives",
          "period"
        ]
      },
      "BudgetPatch": {
        "type": "object",
        "properties": {
          "amountOlives": {
            "description": "A new hard limit; changing it re-arms the period’s alerts.",
            "type": "number"
          },
          "alerts": {
            "description": "Replaces the alert list.",
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "atOlives": {
                  "type": "number",
                  "description": "Spend in the period at which to notify; at most `amountOlives`."
                },
                "channels": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "const": "email"
                  },
                  "description": "Where to notify; `email` reaches the organization’s admins."
                }
              },
              "required": [
                "atOlives",
                "channels"
              ],
              "description": "A soft threshold: notify, never block."
            }
          }
        }
      },
      "BudgetDeleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "deleted"
        ],
        "additionalProperties": false
      },
      "Pricing": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The Martini catalog id, as the user picks it (`kling-v3`); never where it is routed."
                    },
                    "name": {
                      "type": "string",
                      "description": "The display name (`Kling 3`)."
                    },
                    "capability": {
                      "type": "string",
                      "description": "What the model does (`generate-video`, `generate-still`, …)."
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "capability"
                  ],
                  "additionalProperties": false
                },
                "pricing": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "card"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "organization",
                            "list"
                          ],
                          "description": "Whose price this is: the organization’s own, or the public list price."
                        },
                        "card": {
                          "type": "object",
                          "properties": {
                            "unit": {
                              "type": "string",
                              "enum": [
                                "second",
                                "image",
                                "request",
                                "minute",
                                "thousandChars"
                              ],
                              "description": "What one priced unit is."
                            },
                            "olivesPerUnit": {
                              "anyOf": [
                                {
                                  "type": "number",
                                  "description": "Olives, with at most four decimals."
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Olives per unit at the default resolution and quality; null when only `resolutionTiers` price the model."
                            },
                            "minimumOlives": {
                              "description": "The least a generation bills; on the per-minute and per-thousand-character cards, the units billing floors.",
                              "type": "number"
                            },
                            "resolutionTiers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "resolution": {
                                    "type": "string",
                                    "description": "The label a request passes to land in this tier (`720p`, `1080p`, `2K`)."
                                  },
                                  "maxHeight": {
                                    "description": "For a model priced by output height: the tier’s pixel ceiling. The first tier whose ceiling covers the output wins.",
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  },
                                  "byQuality": {
                                    "description": "Olives per unit by render quality, where a quality has its own rate here.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "number",
                                      "description": "Olives, with at most four decimals."
                                    }
                                  },
                                  "aspectFactors": {
                                    "description": "Factors on this tier’s rate by aspect ratio, where they differ from the card’s.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "number"
                                    }
                                  },
                                  "surcharges": {
                                    "description": "The surcharges billed at this tier, in place of the card’s `surcharges` as a whole; an empty object says the tier bills none. Absent, the card’s apply.",
                                    "type": "object",
                                    "properties": {
                                      "audioPerSecond": {
                                        "description": "Added per billed second when audio is on.",
                                        "type": "number"
                                      },
                                      "voicePerSecond": {
                                        "description": "Added per billed second when voice control is on.",
                                        "type": "number"
                                      },
                                      "perReferenceImage": {
                                        "description": "What each reference image sent with the request adds.",
                                        "type": "number"
                                      },
                                      "includedReferenceImages": {
                                        "description": "Reference images included before `perReferenceImage` applies.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "maxReferenceImages": {
                                        "description": "Reference images billed at most; the request sends no more.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "perThousandReferenceTokens": {
                                        "description": "Per 1,000 tokens of reference inputs.",
                                        "type": "number"
                                      },
                                      "includedReferenceTokens": {
                                        "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "resolution",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A resolution tier."
                              }
                            },
                            "durationTiers": {
                              "description": "For a per-request model: the first tier whose `maxSeconds` covers the output’s duration prices it; a longer output bills `olivesPerUnit`.",
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "maxSeconds": {
                                    "type": "number",
                                    "description": "The longest output this tier covers, in seconds."
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "required": [
                                  "maxSeconds",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A duration tier of a per-request model."
                              }
                            },
                            "megapixelTiers": {
                              "description": "For a per-image model priced by output size: the first tier whose `maxMegapixels` covers the output prices it; a larger output bills `olivesPerUnit`.",
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "maxMegapixels": {
                                    "type": "number",
                                    "description": "The largest output this tier covers, in megapixels."
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "required": [
                                  "maxMegapixels",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A size tier of a per-image model."
                              }
                            },
                            "byQuality": {
                              "description": "Olives per unit by render quality, where a quality has its own rate.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number",
                                "description": "Olives, with at most four decimals."
                              }
                            },
                            "qualityFactors": {
                              "description": "Factors on the rate by render quality, where a quality has no rate of its own.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number"
                              }
                            },
                            "aspectFactors": {
                              "description": "Factors on the rate by aspect ratio; the rates are the 16:9 price. A tier’s own `aspectFactors` win at that tier.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number"
                              }
                            },
                            "surcharges": {
                              "description": "Per-second additions and per-input charges, on top of the unit rate. A tier’s own `surcharges` win at that tier.",
                              "type": "object",
                              "properties": {
                                "audioPerSecond": {
                                  "description": "Added per billed second when audio is on.",
                                  "type": "number"
                                },
                                "voicePerSecond": {
                                  "description": "Added per billed second when voice control is on.",
                                  "type": "number"
                                },
                                "perReferenceImage": {
                                  "description": "What each reference image sent with the request adds.",
                                  "type": "number"
                                },
                                "includedReferenceImages": {
                                  "description": "Reference images included before `perReferenceImage` applies.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "maxReferenceImages": {
                                  "description": "Reference images billed at most; the request sends no more.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "perThousandReferenceTokens": {
                                  "description": "Per 1,000 tokens of reference inputs.",
                                  "type": "number"
                                },
                                "includedReferenceTokens": {
                                  "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "additionalProperties": false
                            },
                            "videoReferences": {
                              "description": "How a request that carries video references bills, when it differs.",
                              "type": "object",
                              "properties": {
                                "olivesPerUnit": {
                                  "anyOf": [
                                    {
                                      "type": "number",
                                      "description": "Olives, with at most four decimals."
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Olives per combined second when video references are present; null when only its tiers say."
                                },
                                "resolutionTiers": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "resolution": {
                                        "type": "string",
                                        "description": "The label a request passes to land in this tier (`720p`, `1080p`, `2K`)."
                                      },
                                      "maxHeight": {
                                        "description": "For a model priced by output height: the tier’s pixel ceiling. The first tier whose ceiling covers the output wins.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "olivesPerUnit": {
                                        "type": "number",
                                        "description": "Olives, with at most four decimals."
                                      },
                                      "byQuality": {
                                        "description": "Olives per unit by render quality, where a quality has its own rate here.",
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {
                                          "type": "number",
                                          "description": "Olives, with at most four decimals."
                                        }
                                      },
                                      "aspectFactors": {
                                        "description": "Factors on this tier’s rate by aspect ratio, where they differ from the card’s.",
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {
                                          "type": "number"
                                        }
                                      },
                                      "surcharges": {
                                        "description": "The surcharges billed at this tier, in place of the card’s `surcharges` as a whole; an empty object says the tier bills none. Absent, the card’s apply.",
                                        "type": "object",
                                        "properties": {
                                          "audioPerSecond": {
                                            "description": "Added per billed second when audio is on.",
                                            "type": "number"
                                          },
                                          "voicePerSecond": {
                                            "description": "Added per billed second when voice control is on.",
                                            "type": "number"
                                          },
                                          "perReferenceImage": {
                                            "description": "What each reference image sent with the request adds.",
                                            "type": "number"
                                          },
                                          "includedReferenceImages": {
                                            "description": "Reference images included before `perReferenceImage` applies.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "maxReferenceImages": {
                                            "description": "Reference images billed at most; the request sends no more.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "perThousandReferenceTokens": {
                                            "description": "Per 1,000 tokens of reference inputs.",
                                            "type": "number"
                                          },
                                          "includedReferenceTokens": {
                                            "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "resolution",
                                      "olivesPerUnit"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A resolution tier."
                                  }
                                },
                                "byQuality": {
                                  "description": "Olives per combined second by render quality, where a quality has its own rate.",
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "billsReferenceSeconds": {
                                  "type": "boolean",
                                  "description": "Trimmed reference seconds bill on top of the generated seconds."
                                },
                                "wholeSeconds": {
                                  "description": "Each reference clip bills its whole seconds (9.08 s is 9).",
                                  "type": "boolean"
                                },
                                "minimumOutputFraction": {
                                  "description": "The reference clips bill no less than this fraction of the generated seconds, rounded up.",
                                  "type": "number"
                                }
                              },
                              "required": [
                                "olivesPerUnit",
                                "billsReferenceSeconds"
                              ],
                              "additionalProperties": false
                            },
                            "billedExtraSeconds": {
                              "description": "Seconds billed once per request beyond the generated seconds.",
                              "type": "number"
                            },
                            "isMaximum": {
                              "description": "True when a quote is a ceiling that settles downward once the generation completes.",
                              "type": "boolean"
                            },
                            "chargesBlockedResults": {
                              "description": "True when a result the provider's safety filter blocks after generating it bills like a finished one and is not refunded.",
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "unit",
                            "olivesPerUnit"
                          ],
                          "additionalProperties": false,
                          "description": "The rate this organization pays for a model, as finished olive figures. Nothing says how a number was reached."
                        },
                        "mediaInputCard": {
                          "description": "The card of a request that carries media inputs, when the model prices it differently.",
                          "type": "object",
                          "properties": {
                            "unit": {
                              "type": "string",
                              "enum": [
                                "second",
                                "image",
                                "request",
                                "minute",
                                "thousandChars"
                              ],
                              "description": "What one priced unit is."
                            },
                            "olivesPerUnit": {
                              "anyOf": [
                                {
                                  "type": "number",
                                  "description": "Olives, with at most four decimals."
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Olives per unit at the default resolution and quality; null when only `resolutionTiers` price the model."
                            },
                            "minimumOlives": {
                              "description": "The least a generation bills; on the per-minute and per-thousand-character cards, the units billing floors.",
                              "type": "number"
                            },
                            "resolutionTiers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "resolution": {
                                    "type": "string",
                                    "description": "The label a request passes to land in this tier (`720p`, `1080p`, `2K`)."
                                  },
                                  "maxHeight": {
                                    "description": "For a model priced by output height: the tier’s pixel ceiling. The first tier whose ceiling covers the output wins.",
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  },
                                  "byQuality": {
                                    "description": "Olives per unit by render quality, where a quality has its own rate here.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "number",
                                      "description": "Olives, with at most four decimals."
                                    }
                                  },
                                  "aspectFactors": {
                                    "description": "Factors on this tier’s rate by aspect ratio, where they differ from the card’s.",
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "number"
                                    }
                                  },
                                  "surcharges": {
                                    "description": "The surcharges billed at this tier, in place of the card’s `surcharges` as a whole; an empty object says the tier bills none. Absent, the card’s apply.",
                                    "type": "object",
                                    "properties": {
                                      "audioPerSecond": {
                                        "description": "Added per billed second when audio is on.",
                                        "type": "number"
                                      },
                                      "voicePerSecond": {
                                        "description": "Added per billed second when voice control is on.",
                                        "type": "number"
                                      },
                                      "perReferenceImage": {
                                        "description": "What each reference image sent with the request adds.",
                                        "type": "number"
                                      },
                                      "includedReferenceImages": {
                                        "description": "Reference images included before `perReferenceImage` applies.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "maxReferenceImages": {
                                        "description": "Reference images billed at most; the request sends no more.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "perThousandReferenceTokens": {
                                        "description": "Per 1,000 tokens of reference inputs.",
                                        "type": "number"
                                      },
                                      "includedReferenceTokens": {
                                        "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "resolution",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A resolution tier."
                              }
                            },
                            "durationTiers": {
                              "description": "For a per-request model: the first tier whose `maxSeconds` covers the output’s duration prices it; a longer output bills `olivesPerUnit`.",
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "maxSeconds": {
                                    "type": "number",
                                    "description": "The longest output this tier covers, in seconds."
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "required": [
                                  "maxSeconds",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A duration tier of a per-request model."
                              }
                            },
                            "megapixelTiers": {
                              "description": "For a per-image model priced by output size: the first tier whose `maxMegapixels` covers the output prices it; a larger output bills `olivesPerUnit`.",
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "maxMegapixels": {
                                    "type": "number",
                                    "description": "The largest output this tier covers, in megapixels."
                                  },
                                  "olivesPerUnit": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "required": [
                                  "maxMegapixels",
                                  "olivesPerUnit"
                                ],
                                "additionalProperties": false,
                                "description": "A size tier of a per-image model."
                              }
                            },
                            "byQuality": {
                              "description": "Olives per unit by render quality, where a quality has its own rate.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number",
                                "description": "Olives, with at most four decimals."
                              }
                            },
                            "qualityFactors": {
                              "description": "Factors on the rate by render quality, where a quality has no rate of its own.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number"
                              }
                            },
                            "aspectFactors": {
                              "description": "Factors on the rate by aspect ratio; the rates are the 16:9 price. A tier’s own `aspectFactors` win at that tier.",
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "number"
                              }
                            },
                            "surcharges": {
                              "description": "Per-second additions and per-input charges, on top of the unit rate. A tier’s own `surcharges` win at that tier.",
                              "type": "object",
                              "properties": {
                                "audioPerSecond": {
                                  "description": "Added per billed second when audio is on.",
                                  "type": "number"
                                },
                                "voicePerSecond": {
                                  "description": "Added per billed second when voice control is on.",
                                  "type": "number"
                                },
                                "perReferenceImage": {
                                  "description": "What each reference image sent with the request adds.",
                                  "type": "number"
                                },
                                "includedReferenceImages": {
                                  "description": "Reference images included before `perReferenceImage` applies.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "maxReferenceImages": {
                                  "description": "Reference images billed at most; the request sends no more.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "perThousandReferenceTokens": {
                                  "description": "Per 1,000 tokens of reference inputs.",
                                  "type": "number"
                                },
                                "includedReferenceTokens": {
                                  "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "additionalProperties": false
                            },
                            "videoReferences": {
                              "description": "How a request that carries video references bills, when it differs.",
                              "type": "object",
                              "properties": {
                                "olivesPerUnit": {
                                  "anyOf": [
                                    {
                                      "type": "number",
                                      "description": "Olives, with at most four decimals."
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Olives per combined second when video references are present; null when only its tiers say."
                                },
                                "resolutionTiers": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "resolution": {
                                        "type": "string",
                                        "description": "The label a request passes to land in this tier (`720p`, `1080p`, `2K`)."
                                      },
                                      "maxHeight": {
                                        "description": "For a model priced by output height: the tier’s pixel ceiling. The first tier whose ceiling covers the output wins.",
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "olivesPerUnit": {
                                        "type": "number",
                                        "description": "Olives, with at most four decimals."
                                      },
                                      "byQuality": {
                                        "description": "Olives per unit by render quality, where a quality has its own rate here.",
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {
                                          "type": "number",
                                          "description": "Olives, with at most four decimals."
                                        }
                                      },
                                      "aspectFactors": {
                                        "description": "Factors on this tier’s rate by aspect ratio, where they differ from the card’s.",
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {
                                          "type": "number"
                                        }
                                      },
                                      "surcharges": {
                                        "description": "The surcharges billed at this tier, in place of the card’s `surcharges` as a whole; an empty object says the tier bills none. Absent, the card’s apply.",
                                        "type": "object",
                                        "properties": {
                                          "audioPerSecond": {
                                            "description": "Added per billed second when audio is on.",
                                            "type": "number"
                                          },
                                          "voicePerSecond": {
                                            "description": "Added per billed second when voice control is on.",
                                            "type": "number"
                                          },
                                          "perReferenceImage": {
                                            "description": "What each reference image sent with the request adds.",
                                            "type": "number"
                                          },
                                          "includedReferenceImages": {
                                            "description": "Reference images included before `perReferenceImage` applies.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "maxReferenceImages": {
                                            "description": "Reference images billed at most; the request sends no more.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "perThousandReferenceTokens": {
                                            "description": "Per 1,000 tokens of reference inputs.",
                                            "type": "number"
                                          },
                                          "includedReferenceTokens": {
                                            "description": "Reference tokens included before `perThousandReferenceTokens` applies.",
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "resolution",
                                      "olivesPerUnit"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A resolution tier."
                                  }
                                },
                                "byQuality": {
                                  "description": "Olives per combined second by render quality, where a quality has its own rate.",
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "number",
                                    "description": "Olives, with at most four decimals."
                                  }
                                },
                                "billsReferenceSeconds": {
                                  "type": "boolean",
                                  "description": "Trimmed reference seconds bill on top of the generated seconds."
                                },
                                "wholeSeconds": {
                                  "description": "Each reference clip bills its whole seconds (9.08 s is 9).",
                                  "type": "boolean"
                                },
                                "minimumOutputFraction": {
                                  "description": "The reference clips bill no less than this fraction of the generated seconds, rounded up.",
                                  "type": "number"
                                }
                              },
                              "required": [
                                "olivesPerUnit",
                                "billsReferenceSeconds"
                              ],
                              "additionalProperties": false
                            },
                            "billedExtraSeconds": {
                              "description": "Seconds billed once per request beyond the generated seconds.",
                              "type": "number"
                            },
                            "isMaximum": {
                              "description": "True when a quote is a ceiling that settles downward once the generation completes.",
                              "type": "boolean"
                            },
                            "chargesBlockedResults": {
                              "description": "True when a result the provider's safety filter blocks after generating it bills like a finished one and is not refunded.",
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "unit",
                            "olivesPerUnit"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "kind",
                        "source",
                        "card"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "quote"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false,
                      "description": "Only the generate-time quote can price a request of this model."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "direct"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false,
                      "description": "The organization settles this model outside Martini and is charged no olives."
                    }
                  ],
                  "description": "How a model is priced for this organization; branch on `kind`."
                }
              },
              "required": [
                "model",
                "pricing"
              ],
              "additionalProperties": false
            },
            "description": "Every model the organization can generate with, by catalog id."
          },
          "agentWork": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "model",
                    "compute",
                    "tool"
                  ]
                },
                "id": {
                  "type": "string",
                  "description": "The id the user picks: a chat model id (`opus-5.5`), `sandbox`, or `transcription`."
                },
                "name": {
                  "type": "string"
                },
                "serviceTier": {
                  "type": "string",
                  "enum": [
                    "standard",
                    "fast"
                  ]
                },
                "olivesPerMillion": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "enum": [
                      "input",
                      "cacheRead",
                      "cacheWrite",
                      "cacheWrite1h",
                      "output",
                      "cpuMilliseconds",
                      "memoryMilliseconds",
                      "diskMilliseconds",
                      "computeSeconds"
                    ]
                  },
                  "additionalProperties": {
                    "type": "number"
                  },
                  "description": "Olives per million units of each bucket the resource is metered in; up to eight decimals."
                },
                "longContext": {
                  "description": "Rates past a context length, where the model has them.",
                  "type": "object",
                  "properties": {
                    "thresholdTokens": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "inputFactor": {
                      "type": "number"
                    },
                    "outputFactor": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "thresholdTokens",
                    "inputFactor",
                    "outputFactor"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "kind",
                "id",
                "name",
                "serviceTier",
                "olivesPerMillion"
              ],
              "additionalProperties": false,
              "description": "What the organization pays for agent work on one resource — the finished price, nothing of its terms."
            }
          },
          "oliveValueUsd": {
            "type": "number",
            "description": "The public nominal value of one olive in USD."
          },
          "asOf": {
            "type": "string"
          }
        },
        "required": [
          "organization",
          "models",
          "agentWork",
          "oliveValueUsd",
          "asOf"
        ],
        "additionalProperties": false
      },
      "Costs": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "range": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false,
            "description": "The range asked for, `to` exclusive."
          },
          "bucket": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month"
            ]
          },
          "groupBy": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "project",
                "model",
                "actor",
                "user",
                "apiKey",
                "origin",
                "type",
                "billingMode"
              ]
            }
          },
          "buckets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string",
                  "description": "Inclusive start of the bucket."
                },
                "end": {
                  "type": "string",
                  "description": "Exclusive end of the bucket."
                },
                "results": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "group": {
                        "type": "object",
                        "properties": {
                          "project": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "model": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "The Martini catalog id, as the user picks it (`kling-v3`); never where it is routed."
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "The display name (`Kling 3`)."
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "actor": {
                            "anyOf": [
                              {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "user"
                                      },
                                      "user": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "alias": {
                                            "type": "string",
                                            "description": "The member’s display alias; never an email."
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "alias"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "user"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "apiKey"
                                      },
                                      "apiKey": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string"
                                              },
                                              "label": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "label"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "description": "Null for an API charge recorded before keys were kept on it."
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "apiKey"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "Who caused a charge: a member in the browser, or an API key."
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "user": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "alias": {
                                    "type": "string",
                                    "description": "The member’s display alias; never an email."
                                  }
                                },
                                "required": [
                                  "id",
                                  "alias"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "apiKey": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "origin": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "ui",
                                  "mcp",
                                  "api"
                                ],
                                "description": "Which surface a generation came from."
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "generation",
                              "export",
                              "agentWork",
                              "refund",
                              "topup",
                              "adjustment",
                              "signupBonus",
                              "transfer",
                              "paymentFee"
                            ],
                            "description": "A ledger row’s kind. `agentWork` covers chat turns, workflow runs and builds, and utilities such as transcription."
                          },
                          "billingMode": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "personalTab",
                                  "teamTab",
                                  "generatorPays"
                                ],
                                "description": "Whose tab a charge landed on, as recorded at charge time."
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "additionalProperties": false,
                        "description": "The group a cell belongs to; only the requested `groupBy` keys are present. A null member is unattributed."
                      },
                      "olives": {
                        "type": "number",
                        "description": "Charges in the bucket."
                      },
                      "refundedOlives": {
                        "type": "number",
                        "description": "Olives, with at most four decimals."
                      },
                      "netOlives": {
                        "type": "number",
                        "description": "`olives` minus `refundedOlives`."
                      },
                      "generations": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991,
                        "description": "Charged generations in the bucket; agent work and non-generation rows do not count."
                      }
                    },
                    "required": [
                      "group",
                      "olives",
                      "refundedOlives",
                      "netOlives",
                      "generations"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "start",
                "end",
                "results"
              ],
              "additionalProperties": false
            },
            "description": "Calendar-aligned in UTC, oldest first; a bucket with no spend is empty."
          },
          "nextCursor": {
            "description": "Pass back as `cursor` for the next page of buckets; null on the last.",
            "type": [
              "string",
              "null"
            ]
          },
          "asOf": {
            "type": "string"
          }
        },
        "required": [
          "organization",
          "range",
          "bucket",
          "groupBy",
          "buckets",
          "nextCursor",
          "asOf"
        ],
        "additionalProperties": false
      },
      "Transactions": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "transactions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "generation",
                    "export",
                    "agentWork",
                    "refund",
                    "topup",
                    "adjustment",
                    "signupBonus",
                    "transfer",
                    "paymentFee"
                  ],
                  "description": "A ledger row’s kind. `agentWork` covers chat turns, workflow runs and builds, and utilities such as transcription."
                },
                "olives": {
                  "type": "number",
                  "description": "Signed: charges negative, grants and refunds positive."
                },
                "billingMode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "personalTab",
                        "teamTab",
                        "generatorPays"
                      ],
                      "description": "Whose tab a charge landed on, as recorded at charge time."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "project": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "actor": {
                  "anyOf": [
                    {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "user"
                            },
                            "user": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "alias": {
                                  "type": "string",
                                  "description": "The member’s display alias; never an email."
                                }
                              },
                              "required": [
                                "id",
                                "alias"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "user"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "apiKey"
                            },
                            "apiKey": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "label"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Null for an API charge recorded before keys were kept on it."
                            }
                          },
                          "required": [
                            "type",
                            "apiKey"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "Who caused a charge: a member in the browser, or an API key."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "generation": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "model": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "The Martini catalog id, as the user picks it (`kling-v3`); never where it is routed."
                                },
                                "name": {
                                  "type": "string",
                                  "description": "The display name (`Kling 3`)."
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "origin": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ui",
                                "mcp",
                                "api"
                              ],
                              "description": "Which surface a generation came from."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "model",
                        "origin"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The charged generation; null for agent work, grants, and adjustments."
                },
                "idempotencyKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "createdAt",
                "type",
                "olives",
                "billingMode",
                "project",
                "actor",
                "generation",
                "idempotencyKey"
              ],
              "additionalProperties": false
            },
            "description": "Newest first."
          },
          "nextCursor": {
            "description": "Pass back as `cursor` for the next page; null on the last.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "organization",
          "transactions",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "Invoices": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The organization the numbers belong to."
          },
          "invoices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "paid",
                    "open",
                    "void",
                    "uncollectible",
                    "draft"
                  ]
                },
                "total": {
                  "type": "object",
                  "properties": {
                    "amount": {
                      "type": "number",
                      "description": "In major units of `currency`."
                    },
                    "currency": {
                      "type": "string",
                      "description": "ISO 4217, lowercase."
                    }
                  },
                  "required": [
                    "amount",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "createdAt",
                "status",
                "total"
              ],
              "additionalProperties": false
            },
            "description": "Newest first."
          }
        },
        "required": [
          "organization",
          "invoices"
        ],
        "additionalProperties": false
      },
      "InvoiceDownload": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "expiresIn": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Seconds until `url` stops working."
          }
        },
        "required": [
          "invoiceId",
          "url",
          "expiresIn"
        ],
        "additionalProperties": false,
        "description": "A short-lived link to the invoice PDF, the way run results hand out URLs."
      },
      "ProjectList": {
        "type": "object",
        "properties": {
          "projects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Pass this as `projectId` wherever a route accepts one."
                },
                "name": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                },
                "visibility": {
                  "type": "string",
                  "enum": [
                    "private",
                    "link_view",
                    "link_edit"
                  ],
                  "description": "What a share link grants someone who is not a member: nothing, viewing, or editing."
                },
                "canEdit": {
                  "type": "boolean",
                  "description": "Whether the key’s user can edit the project — run workflows in it, place copies, upload and generate into it. A project listed with `false` is theirs to read only."
                },
                "openInMartini": {
                  "type": "string",
                  "description": "The project in the Martini app, on its default canvas."
                },
                "links": {
                  "type": "object",
                  "properties": {
                    "canvases": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "canvases"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "name",
                "createdAt",
                "visibility",
                "canEdit",
                "openInMartini",
                "links"
              ],
              "additionalProperties": false
            },
            "description": "Most recently joined first; ranked by match when `query` is given."
          },
          "totalMatched": {
            "type": "number",
            "description": "How many projects matched before `limit` was applied."
          },
          "limit": {
            "type": "number"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when `totalMatched` exceeds `limit`."
          }
        },
        "required": [
          "projects",
          "totalMatched",
          "limit",
          "truncated"
        ],
        "additionalProperties": false
      },
      "CanvasList": {
        "type": "object",
        "properties": {
          "project": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "canvases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Pass this as `canvasId` wherever a route accepts one."
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string"
                },
                "isDefault": {
                  "type": "boolean",
                  "description": "True on the first canvas: where the project opens, and where a generation into the project lands when no `canvasId` is given."
                },
                "openInMartini": {
                  "type": "string",
                  "description": "The canvas in the Martini app."
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "createdAt",
                "isDefault",
                "openInMartini"
              ],
              "additionalProperties": false
            },
            "description": "In the order the app lists them."
          }
        },
        "required": [
          "project",
          "canvases"
        ],
        "additionalProperties": false
      },
      "Generation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Public request id; also the canvas asset the generation lands on."
          },
          "endpoint": {
            "type": "string",
            "description": "The registered alias the request was submitted against."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "pending",
              "running",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "origin": {
            "type": "string",
            "const": "api"
          },
          "createdAt": {
            "type": "string"
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "oliveCost": {
            "description": "Snapshotted charge in olives: 0 when the generation runs on your organization's own provider key (`providerKeySource: byok`). Null only while a concurrent idempotent submit is still being priced.",
            "type": [
              "number",
              "null"
            ]
          },
          "providerKeySource": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "martini",
                  "byok"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Whose provider key the generation runs on: `martini` (charged in olives) or `byok` (your organization's own key; the provider bills you and no olives are charged). Null until the request is submitted."
          },
          "imageBilling": {
            "description": "For capped contract-cost image pricing: the original maximum, current charge and confirmed automatic return. Pending may continue after generation completes.",
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "final"
                ]
              },
              "maximumOlives": {
                "type": "number"
              },
              "chargedOlives": {
                "type": "number"
              },
              "returnedOlives": {
                "type": "number"
              }
            },
            "required": [
              "status",
              "maximumOlives",
              "chargedOlives",
              "returnedOlives"
            ],
            "additionalProperties": false
          },
          "output": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "The model output in its fal field names once status is completed; otherwise null."
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "martini": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "previewUrl": {
                    "type": "string"
                  },
                  "projectId": {
                    "type": "string"
                  },
                  "canvasId": {
                    "type": "string"
                  },
                  "assetId": {
                    "type": "string"
                  }
                },
                "required": [
                  "previewUrl",
                  "projectId",
                  "canvasId",
                  "assetId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "links": {
            "type": "object",
            "properties": {
              "self": {
                "type": "string"
              },
              "cancel": {
                "type": "string"
              },
              "generate": {
                "type": "string"
              }
            },
            "required": [
              "self",
              "cancel"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "endpoint",
          "status",
          "origin",
          "createdAt",
          "startedAt",
          "completedAt",
          "oliveCost",
          "providerKeySource",
          "output",
          "error",
          "warnings",
          "martini",
          "links"
        ],
        "additionalProperties": false
      },
      "Models": {
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "endpoint": {
                  "type": "string",
                  "description": "Pass this as `endpoint` to POST /v1/generations."
                },
                "modelId": {
                  "type": "string"
                },
                "billableUnit": {
                  "type": "string",
                  "enum": [
                    "image",
                    "second"
                  ]
                },
                "model": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "capability": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string"
                    },
                    "pricing": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "display": {
                          "type": "string"
                        },
                        "referenceTokens": {
                          "type": "object",
                          "properties": {
                            "includedTokens": {
                              "type": "number"
                            },
                            "olivesPer1kTokens": {
                              "type": "number"
                            },
                            "processedShortEdge": {
                              "type": "number"
                            },
                            "dimensionStep": {
                              "type": "number"
                            },
                            "pixelsPerToken": {
                              "type": "number"
                            },
                            "estimateTokensPerUnmeasuredImage": {
                              "type": "number"
                            },
                            "maxImages": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "includedTokens",
                            "olivesPer1kTokens",
                            "processedShortEdge",
                            "dimensionStep",
                            "pixelsPerToken",
                            "estimateTokensPerUnmeasuredImage",
                            "maxImages"
                          ],
                          "additionalProperties": false
                        },
                        "referenceImages": {
                          "type": "object",
                          "properties": {
                            "included": {
                              "type": "number"
                            },
                            "olivesPerAdditional": {
                              "type": "number"
                            },
                            "maxBillable": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "included",
                            "olivesPerAdditional",
                            "maxBillable"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "estimatedQueueTimeSeconds": {
                      "type": "number"
                    },
                    "estimatedGenerationTimeSeconds": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "provider",
                    "capability",
                    "pricing"
                  ],
                  "additionalProperties": false
                },
                "providerKeySource": {
                  "type": "string",
                  "enum": [
                    "martini",
                    "byok"
                  ],
                  "description": "Whose provider key a generation on this endpoint runs on for your organization: `byok` when you set the model's provider to your own key (no olives charged, so the olive pricing — `model.pricing.display`, its reference surcharges and `pricing` — is omitted), else `martini` (charged in olives)."
                },
                "listPrice": {
                  "type": "object",
                  "properties": {
                    "unit": {
                      "type": "string",
                      "enum": [
                        "second",
                        "image"
                      ],
                      "description": "What one unit of the price is: a second of output or one image."
                    },
                    "olives": {
                      "type": "object",
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "min",
                        "max"
                      ],
                      "additionalProperties": false,
                      "description": "The price range per unit, in olives."
                    },
                    "usd": {
                      "type": "object",
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "min",
                        "max"
                      ],
                      "additionalProperties": false,
                      "description": "The same range in US dollars."
                    },
                    "resolutions": {
                      "description": "The base price per unit at each resolution, where the model prices by resolution.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "resolution": {
                            "type": "string",
                            "description": "`1080p` style for video (outputs up to that height), the output size for images."
                          },
                          "olives": {
                            "type": "number"
                          },
                          "usd": {
                            "type": "number"
                          },
                          "audioSurcharge": {
                            "description": "Added per second at this resolution with audio on.",
                            "type": "object",
                            "properties": {
                              "olives": {
                                "type": "number"
                              },
                              "usd": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "olives",
                              "usd"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "resolution",
                          "olives",
                          "usd"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "audioSurcharge": {
                      "description": "Added per second with audio on.",
                      "type": "object",
                      "properties": {
                        "olives": {
                          "type": "number"
                        },
                        "usd": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "olives",
                        "usd"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "unit",
                    "olives",
                    "usd"
                  ],
                  "additionalProperties": false,
                  "description": "Martini's published list price per unit on Martini's own provider key, without negotiated pricing. Present for every caller, with or without a key, and on `byok` entries too, as the price to compare against. Quality, video-input and voice options stay inside the range."
                },
                "pricing": {
                  "type": "object",
                  "properties": {
                    "multiplier": {
                      "description": "Legacy: the factor of the model-wide rule, when it has one.",
                      "type": "number"
                    },
                    "resolutionMultipliers": {
                      "description": "Legacy: the factors of resolution-scoped rules that have one.",
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "number"
                      }
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "scope": {
                                "description": "Normalized resolution the rule prices (e.g. `720p`), or null for the model-wide rule. A resolution scope wins over the model-wide one.",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "const": "absolute"
                              },
                              "unit": {
                                "type": "string",
                                "enum": [
                                  "second",
                                  "image"
                                ]
                              },
                              "output": {
                                "type": "object",
                                "properties": {
                                  "olives": {
                                    "type": "number"
                                  },
                                  "per": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "olives",
                                  "per"
                                ],
                                "additionalProperties": false,
                                "description": "Price of generated output, independent of provider routing."
                              },
                              "videoReference": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "olives": {
                                        "type": "number"
                                      },
                                      "per": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "olives",
                                      "per"
                                    ],
                                    "additionalProperties": false,
                                    "description": "`olives` per `per` units, e.g. `{ \"olives\": 23, \"per\": 15 }` = 23 olives per 15 seconds."
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Price per combined second (output + trimmed reference video) when the request carries video references; null means the agreement does not price reference-to-video and the rule does not apply to such requests."
                              }
                            },
                            "required": [
                              "scope",
                              "kind",
                              "unit",
                              "output",
                              "videoReference"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "scope": {
                                "description": "Normalized resolution the rule prices (e.g. `720p`), or null for the model-wide rule. A resolution scope wins over the model-wide one.",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "const": "percentage"
                              },
                              "percentOff": {
                                "type": "number",
                                "description": "Percent off the published list price (20 = 20% off)."
                              },
                              "basis": {
                                "type": "string",
                                "const": "published_list"
                              },
                              "basisPolicy": {
                                "type": "string",
                                "enum": [
                                  "floating",
                                  "pinned"
                                ]
                              },
                              "basisVersion": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "scope",
                              "kind",
                              "percentOff",
                              "basis",
                              "basisPolicy",
                              "basisVersion"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "scope": {
                                "description": "Normalized resolution the rule prices (e.g. `720p`), or null for the model-wide rule. A resolution scope wins over the model-wide one.",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "const": "multiplier"
                              },
                              "multiplier": {
                                "type": "number",
                                "description": "Legacy factor over the routed list cost; being retired."
                              }
                            },
                            "required": [
                              "scope",
                              "kind",
                              "multiplier"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "scope": {
                                "description": "Normalized resolution the rule prices (e.g. `720p`), or null for the model-wide rule. A resolution scope wins over the model-wide one.",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "const": "standard"
                              }
                            },
                            "required": [
                              "scope",
                              "kind"
                            ],
                            "additionalProperties": false,
                            "description": "Standard pricing for this scope."
                          }
                        ],
                        "description": "One effective negotiated pricing rule for your organization."
                      }
                    }
                  },
                  "required": [
                    "rules"
                  ],
                  "additionalProperties": false,
                  "description": "Your organization's negotiated pricing for this model; absent at standard pricing."
                },
                "deprecation": {
                  "type": "object",
                  "properties": {
                    "sunsetDate": {
                      "type": "string"
                    },
                    "supersededBy": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": [
                "endpoint",
                "modelId",
                "billableUnit",
                "model",
                "providerKeySource",
                "listPrice"
              ],
              "additionalProperties": false
            },
            "description": "The Generation API: one entry per endpoint alias POST /v1/generations accepts."
          },
          "catalog": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Pass this as `modelId` to the generate tools (POST /v1/tools/generate, the CLI, the MCP)."
                },
                "name": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "capability": {
                  "type": "string",
                  "description": "`generate-video`, `generate-still`, `generate-audio`, `upscale-video`, `generate-set-3d`, …"
                },
                "mode": {
                  "type": "string"
                },
                "pricing": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "display": {
                      "type": "string",
                      "description": "The price as the app shows it. `listPrice.unit` is the unit actually billed; the wording here can be looser (a per-minute model may read \"per generation\")."
                    }
                  },
                  "required": [
                    "type",
                    "display"
                  ],
                  "additionalProperties": false
                },
                "listPrice": {
                  "type": "object",
                  "properties": {
                    "unit": {
                      "type": "string",
                      "enum": [
                        "second",
                        "image",
                        "minute",
                        "thousand_characters",
                        "request"
                      ],
                      "description": "What one unit of the price is: a second or minute of output, one image, a thousand characters of text-to-speech input, or one request (a music track, a sound effect)."
                    },
                    "olives": {
                      "type": "object",
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "min",
                        "max"
                      ],
                      "additionalProperties": false,
                      "description": "The price range per unit, in olives."
                    },
                    "usd": {
                      "type": "object",
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "min",
                        "max"
                      ],
                      "additionalProperties": false,
                      "description": "The same range in US dollars."
                    },
                    "resolutions": {
                      "description": "The base price per unit at each resolution, where the model prices by resolution.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "resolution": {
                            "type": "string",
                            "description": "`1080p` style for video (outputs up to that height), the output size for images."
                          },
                          "olives": {
                            "type": "number"
                          },
                          "usd": {
                            "type": "number"
                          },
                          "audioSurcharge": {
                            "description": "Added per second at this resolution with audio on.",
                            "type": "object",
                            "properties": {
                              "olives": {
                                "type": "number"
                              },
                              "usd": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "olives",
                              "usd"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "resolution",
                          "olives",
                          "usd"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "audioSurcharge": {
                      "description": "Added per second with audio on.",
                      "type": "object",
                      "properties": {
                        "olives": {
                          "type": "number"
                        },
                        "usd": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "olives",
                        "usd"
                      ],
                      "additionalProperties": false
                    },
                    "floor": {
                      "description": "The least one generation is charged, when the model sets a per-generation minimum: not a price per unit, so it is outside `olives` and `usd`. Seed Audio holds it up front and settles to the minutes billed.",
                      "type": "object",
                      "properties": {
                        "olives": {
                          "type": "number"
                        },
                        "usd": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "olives",
                        "usd"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "unit",
                    "olives",
                    "usd"
                  ],
                  "additionalProperties": false,
                  "description": "Martini's published list price per unit on Martini's own provider key, for every caller: `olives` and `usd` span the same bounds as `pricing.display`."
                },
                "endpoints": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The entries of `models` that run this model; empty when only the tools reach it."
                }
              },
              "required": [
                "id",
                "name",
                "provider",
                "capability",
                "pricing",
                "listPrice",
                "endpoints"
              ],
              "additionalProperties": false,
              "description": "One model the generate tools accept, with its list price."
            },
            "description": "Every model the generate tools accept that is open to the caller, with its list price: the roster the tools, the CLI and the MCP reach by `id`, audio and voice included. A set model, a mask-only (Edit Region) model and an app-only launch are not listed, as the tools refuse them. The Generation API reaches the ones with `endpoints`."
          }
        },
        "required": [
          "apiVersion",
          "models",
          "catalog"
        ],
        "additionalProperties": false
      },
      "CreateGeneration": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "enum": [
              "alibaba/wan-3.0-prime/image-to-video",
              "alibaba/wan-3.0-prime/reference-to-video",
              "alibaba/wan-3.0-prime/text-to-video",
              "alibaba/wan-3.0/image-to-video",
              "alibaba/wan-3.0/reference-to-video",
              "alibaba/wan-3.0/text-to-video",
              "bytedance/seedance-2.0/fast/image-to-video",
              "bytedance/seedance-2.0/fast/reference-to-video",
              "bytedance/seedance-2.0/fast/text-to-video",
              "bytedance/seedance-2.0/image-to-video",
              "bytedance/seedance-2.0/mini/image-to-video",
              "bytedance/seedance-2.0/mini/reference-to-video",
              "bytedance/seedance-2.0/mini/text-to-video",
              "bytedance/seedance-2.0/reference-to-video",
              "bytedance/seedance-2.0/text-to-video",
              "bytedance/seedance-2.5/image-to-video",
              "bytedance/seedance-2.5/reference-to-video",
              "bytedance/seedance-2.5/text-to-video",
              "creatify/boreal",
              "fal-ai/minimax/hailuo-03/image-to-video",
              "fal-ai/minimax/hailuo-03/reference-to-video",
              "fal-ai/minimax/hailuo-03/text-to-video",
              "fal-ai/nano-banana-2",
              "fal-ai/nano-banana-2/edit",
              "martini/seedance-2.5-custom-draft-enhance",
              "martini/seedance-2.5-custom-edit-draft-enhance",
              "martini/seedance-2.5-draft-enhance",
              "martini/seedance-2.5-edit-draft-enhance",
              "minimax/h3-max-turbo/image-to-video",
              "minimax/h3-max-turbo/text-to-video",
              "minimax/h3-max/image-to-video",
              "minimax/h3-max/reference-to-video",
              "minimax/h3-max/text-to-video",
              "minimax/h3/image-to-video",
              "minimax/h3/reference-to-video",
              "minimax/h3/text-to-video",
              "xai/grok-imagine-video/v1.5/image-to-video",
              "xai/grok-imagine-video/v1.5/reference-to-video",
              "xai/grok-imagine-video/v1.5/text-to-video"
            ],
            "description": "A registered alias exactly as GET /v1/models lists it. Selects which GenerationInput.* schema `input` must match."
          },
          "input": {
            "type": "object",
            "description": "The model input in its fal field names, validated strictly against the GenerationInput.* schema for `endpoint` (unknown fields are rejected with UNSUPPORTED_INPUT). The `allOf` conditionals select it; `x-martini-input-schemas` lists the same alias → schema map for tools that skip conditionals."
          },
          "projectId": {
            "description": "Override the key's default project. Without `canvasId`, the project's first canvas is used.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "canvasId": {
            "description": "Override the key's default canvas; requires `projectId`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "placement": {
            "description": "Only `auto` (next to the last node on the canvas) is supported.",
            "type": "string",
            "const": "auto"
          },
          "idempotencyKey": {
            "description": "Re-posting the same key with the same request returns the generation the first call created.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "mode": {
            "description": "`draft` creates an editable node without charging or contacting a provider.",
            "type": "string",
            "const": "draft"
          }
        },
        "required": [
          "endpoint",
          "input"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0-prime/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0-prime/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0-prime/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "alibaba/wan-3.0/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.alibaba.wan-3.0.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/fast/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/fast/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/fast/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/mini/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/mini/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/mini/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.0/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.5/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.5/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "bytedance/seedance-2.5/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "creatify/boreal"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.creatify.boreal"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "fal-ai/minimax/hailuo-03/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "fal-ai/minimax/hailuo-03/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "fal-ai/minimax/hailuo-03/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "fal-ai/nano-banana-2"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.fal-ai.nano-banana-2"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "fal-ai/nano-banana-2/edit"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.fal-ai.nano-banana-2.edit"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "martini/seedance-2.5-custom-draft-enhance"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.martini.seedance-2.5-custom-draft-enhance"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "martini/seedance-2.5-custom-edit-draft-enhance"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.martini.seedance-2.5-custom-edit-draft-enhance"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "martini/seedance-2.5-draft-enhance"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.martini.seedance-2.5-draft-enhance"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "martini/seedance-2.5-edit-draft-enhance"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.martini.seedance-2.5-edit-draft-enhance"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3-max-turbo/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3-max-turbo.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3-max-turbo/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3-max-turbo.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3-max/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3-max.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3-max/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3-max.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3-max/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3-max.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "minimax/h3/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.minimax.h3.text-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "xai/grok-imagine-video/v1.5/image-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.image-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "xai/grok-imagine-video/v1.5/reference-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.reference-to-video"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "endpoint": {
                  "const": "xai/grok-imagine-video/v1.5/text-to-video"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            "then": {
              "properties": {
                "input": {
                  "$ref": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.text-to-video"
                }
              }
            }
          }
        ],
        "x-martini-input-schemas": {
          "alibaba/wan-3.0-prime/image-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.image-to-video",
          "alibaba/wan-3.0-prime/reference-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.reference-to-video",
          "alibaba/wan-3.0-prime/text-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0-prime.text-to-video",
          "alibaba/wan-3.0/image-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0.image-to-video",
          "alibaba/wan-3.0/reference-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0.reference-to-video",
          "alibaba/wan-3.0/text-to-video": "#/components/schemas/GenerationInput.alibaba.wan-3.0.text-to-video",
          "bytedance/seedance-2.0/fast/image-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.image-to-video",
          "bytedance/seedance-2.0/fast/reference-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.reference-to-video",
          "bytedance/seedance-2.0/fast/text-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.fast.text-to-video",
          "bytedance/seedance-2.0/image-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.image-to-video",
          "bytedance/seedance-2.0/mini/image-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.image-to-video",
          "bytedance/seedance-2.0/mini/reference-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.reference-to-video",
          "bytedance/seedance-2.0/mini/text-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.mini.text-to-video",
          "bytedance/seedance-2.0/reference-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.reference-to-video",
          "bytedance/seedance-2.0/text-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.0.text-to-video",
          "bytedance/seedance-2.5/image-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.image-to-video",
          "bytedance/seedance-2.5/reference-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.reference-to-video",
          "bytedance/seedance-2.5/text-to-video": "#/components/schemas/GenerationInput.bytedance.seedance-2.5.text-to-video",
          "creatify/boreal": "#/components/schemas/GenerationInput.creatify.boreal",
          "fal-ai/minimax/hailuo-03/image-to-video": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.image-to-video",
          "fal-ai/minimax/hailuo-03/reference-to-video": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.reference-to-video",
          "fal-ai/minimax/hailuo-03/text-to-video": "#/components/schemas/GenerationInput.fal-ai.minimax.hailuo-03.text-to-video",
          "fal-ai/nano-banana-2": "#/components/schemas/GenerationInput.fal-ai.nano-banana-2",
          "fal-ai/nano-banana-2/edit": "#/components/schemas/GenerationInput.fal-ai.nano-banana-2.edit",
          "martini/seedance-2.5-custom-draft-enhance": "#/components/schemas/GenerationInput.martini.seedance-2.5-custom-draft-enhance",
          "martini/seedance-2.5-custom-edit-draft-enhance": "#/components/schemas/GenerationInput.martini.seedance-2.5-custom-edit-draft-enhance",
          "martini/seedance-2.5-draft-enhance": "#/components/schemas/GenerationInput.martini.seedance-2.5-draft-enhance",
          "martini/seedance-2.5-edit-draft-enhance": "#/components/schemas/GenerationInput.martini.seedance-2.5-edit-draft-enhance",
          "minimax/h3-max-turbo/image-to-video": "#/components/schemas/GenerationInput.minimax.h3-max-turbo.image-to-video",
          "minimax/h3-max-turbo/text-to-video": "#/components/schemas/GenerationInput.minimax.h3-max-turbo.text-to-video",
          "minimax/h3-max/image-to-video": "#/components/schemas/GenerationInput.minimax.h3-max.image-to-video",
          "minimax/h3-max/reference-to-video": "#/components/schemas/GenerationInput.minimax.h3-max.reference-to-video",
          "minimax/h3-max/text-to-video": "#/components/schemas/GenerationInput.minimax.h3-max.text-to-video",
          "minimax/h3/image-to-video": "#/components/schemas/GenerationInput.minimax.h3.image-to-video",
          "minimax/h3/reference-to-video": "#/components/schemas/GenerationInput.minimax.h3.reference-to-video",
          "minimax/h3/text-to-video": "#/components/schemas/GenerationInput.minimax.h3.text-to-video",
          "xai/grok-imagine-video/v1.5/image-to-video": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.image-to-video",
          "xai/grok-imagine-video/v1.5/reference-to-video": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.reference-to-video",
          "xai/grok-imagine-video/v1.5/text-to-video": "#/components/schemas/GenerationInput.xai.grok-imagine-video.v1.5.text-to-video"
        }
      },
      "WorkflowVersionLabels": {
        "type": "object",
        "properties": {
          "labels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organizationId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "type": "string"
                },
                "color": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organizationId",
                "name",
                "color",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "labels"
        ],
        "additionalProperties": false
      },
      "WorkflowVersionLabelResult": {
        "type": "object",
        "properties": {
          "label": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organizationId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "organizationId",
              "name",
              "color",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "label"
        ],
        "additionalProperties": false
      },
      "WorkflowRevisionLabels": {
        "type": "object",
        "properties": {
          "labelsByRevisionId": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "organizationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "color": {
                    "type": "string"
                  },
                  "createdAt": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "organizationId",
                  "name",
                  "color",
                  "createdAt"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "required": [
          "labelsByRevisionId"
        ],
        "additionalProperties": false
      },
      "WorkflowLabelAssigned": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "CreateWorkflowVersionLabel": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "color": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{6}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "required": [
          "orgId",
          "name"
        ],
        "additionalProperties": false
      },
      "UpdateWorkflowVersionLabel": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "color": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{6}$"
          }
        },
        "required": [
          "orgId",
          "color"
        ],
        "additionalProperties": false
      },
      "WorkflowList": {
        "type": "object",
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "revisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "versionLabel": {
                      "type": "string"
                    },
                    "releaseMode": {
                      "type": "string",
                      "enum": [
                        "legacy",
                        "managed"
                      ]
                    },
                    "productionRevisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "headRevisionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "headVersion": {
                      "type": "number"
                    },
                    "headVersionLabel": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "const": "saved"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "version": {
                      "type": "number"
                    },
                    "fingerprint": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "agent": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "agent"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "inputs": {
                      "type": "object",
                      "properties": {
                        "variables": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Scoped to the returned workflow: saved source id or placed canvas id. Copies have new ids."
                              },
                              "name": {
                                "type": "string",
                                "description": "Accepted as a case-insensitive key in run variables; avoids reusing ids across copies."
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "value"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "bins": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "hasDefault": {
                                "type": "boolean",
                                "description": "Omit this input to use its saved preset (including inherited folders) or default JSON files. An explicit bins entry replaces the preset subtree; [] empties media bins, while JSON file inputs still require files. False means the caller must supply this input."
                              },
                              "fileInput": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "format": {
                                    "type": "string",
                                    "const": "json"
                                  },
                                  "cardinality": {
                                    "type": "string",
                                    "enum": [
                                      "one",
                                      "many"
                                    ]
                                  },
                                  "defaultFiles": {
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "storageAssetId": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "filename": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "uri": {
                                          "type": "string",
                                          "maxLength": 2048
                                        },
                                        "checksum": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        },
                                        "sizeBytes": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 10485760
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "storageAssetId",
                                        "filename",
                                        "uri",
                                        "checksum",
                                        "sizeBytes"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "key",
                                  "format",
                                  "cardinality"
                                ],
                                "additionalProperties": false
                              },
                              "required": {
                                "type": "boolean",
                                "description": "True when this saved bin needs caller input; false when omitted input uses saved defaults."
                              },
                              "defaultSource": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "saved_preset",
                                      "saved_files"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Contents used when the bin is omitted. null means caller input is required. Explicit bin overrides replace these defaults."
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "hasDefault",
                              "required",
                              "defaultSource"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "variables",
                        "bins"
                      ],
                      "additionalProperties": false
                    },
                    "outputs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "bin",
                              "variable",
                              "note",
                              "asset"
                            ]
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "runs": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "runs"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "name",
                    "description",
                    "version",
                    "fingerprint",
                    "updatedAt",
                    "steps",
                    "inputs",
                    "outputs",
                    "links"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "const": "placed"
                    },
                    "name": {
                      "type": "string"
                    },
                    "savedWorkflow": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "version": {
                              "type": [
                                "number",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fingerprint": {
                      "type": "string"
                    },
                    "project": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "canvas": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "inputs": {
                      "type": "object",
                      "properties": {
                        "variables": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Scoped to the returned workflow: saved source id or placed canvas id. Copies have new ids."
                              },
                              "name": {
                                "type": "string",
                                "description": "Accepted as a case-insensitive key in run variables; avoids reusing ids across copies."
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "value"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "bins": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "fileInput": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "format": {
                                    "type": "string",
                                    "const": "json"
                                  },
                                  "cardinality": {
                                    "type": "string",
                                    "enum": [
                                      "one",
                                      "many"
                                    ]
                                  },
                                  "defaultFiles": {
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "storageAssetId": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "filename": {
                                          "type": "string",
                                          "maxLength": 200
                                        },
                                        "uri": {
                                          "type": "string",
                                          "maxLength": 2048
                                        },
                                        "checksum": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        },
                                        "sizeBytes": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 10485760
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "storageAssetId",
                                        "filename",
                                        "uri",
                                        "checksum",
                                        "sizeBytes"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "key",
                                  "format",
                                  "cardinality"
                                ],
                                "additionalProperties": false
                              },
                              "assetCount": {
                                "type": "number",
                                "description": "Runnable assets, text notes and variables in this bin and all descendant bins on the same canvas. Folders themselves do not count. Informational: zero does not by itself mean a run is rejected."
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "assetCount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "variables",
                        "bins"
                      ],
                      "additionalProperties": false
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "runs": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "runs"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "name",
                    "savedWorkflow",
                    "fingerprint",
                    "project",
                    "canvas",
                    "createdAt",
                    "inputs",
                    "links"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "workflows"
        ],
        "additionalProperties": false
      },
      "Workflow": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/SavedWorkflow"
          },
          {
            "$ref": "#/components/schemas/PlacedWorkflow"
          }
        ],
        "discriminator": {
          "propertyName": "kind"
        }
      },
      "SavedWorkflow": {
        "type": "object",
        "properties": {
          "revisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "versionLabel": {
            "type": "string"
          },
          "releaseMode": {
            "type": "string",
            "enum": [
              "legacy",
              "managed"
            ]
          },
          "productionRevisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "headRevisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "headVersion": {
            "type": "number"
          },
          "headVersionLabel": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "saved"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "version": {
            "type": "number"
          },
          "fingerprint": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "agent": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "agent"
              ],
              "additionalProperties": false
            }
          },
          "inputs": {
            "type": "object",
            "properties": {
              "variables": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scoped to the returned workflow: saved source id or placed canvas id. Copies have new ids."
                    },
                    "name": {
                      "type": "string",
                      "description": "Accepted as a case-insensitive key in run variables; avoids reusing ids across copies."
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "bins": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "hasDefault": {
                      "type": "boolean",
                      "description": "Omit this input to use its saved preset (including inherited folders) or default JSON files. An explicit bins entry replaces the preset subtree; [] empties media bins, while JSON file inputs still require files. False means the caller must supply this input."
                    },
                    "fileInput": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                        },
                        "format": {
                          "type": "string",
                          "const": "json"
                        },
                        "cardinality": {
                          "type": "string",
                          "enum": [
                            "one",
                            "many"
                          ]
                        },
                        "defaultFiles": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "storageAssetId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "filename": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "uri": {
                                "type": "string",
                                "maxLength": 2048
                              },
                              "checksum": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sizeBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760
                              }
                            },
                            "required": [
                              "id",
                              "storageAssetId",
                              "filename",
                              "uri",
                              "checksum",
                              "sizeBytes"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "format",
                        "cardinality"
                      ],
                      "additionalProperties": false
                    },
                    "required": {
                      "type": "boolean",
                      "description": "True when this saved bin needs caller input; false when omitted input uses saved defaults."
                    },
                    "defaultSource": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "saved_preset",
                            "saved_files"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Contents used when the bin is omitted. null means caller input is required. Explicit bin overrides replace these defaults."
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "hasDefault",
                    "required",
                    "defaultSource"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "variables",
              "bins"
            ],
            "additionalProperties": false
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "bin",
                    "variable",
                    "note",
                    "asset"
                  ]
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "runs": {
                "type": "string"
              }
            },
            "required": [
              "runs"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "description",
          "version",
          "fingerprint",
          "updatedAt",
          "steps",
          "inputs",
          "outputs",
          "links"
        ],
        "additionalProperties": false
      },
      "SavedWorkflowRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "saved"
          },
          "organizationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "folder": {
            "type": [
              "string",
              "null"
            ]
          },
          "versionOf": {
            "type": [
              "string",
              "null"
            ]
          },
          "enginePin": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "engine": {
                    "type": "string",
                    "const": "fable"
                  },
                  "oliveBudget": {
                    "type": "number"
                  }
                },
                "required": [
                  "engine",
                  "oliveBudget"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "number"
          },
          "definition": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "actions": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "name",
              "actions"
            ],
            "additionalProperties": {}
          },
          "sourceWorkflowId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "revisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "versionLabel": {
            "type": "string"
          },
          "releaseMode": {
            "type": "string",
            "enum": [
              "legacy",
              "managed"
            ]
          },
          "productionRevisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "releaseGeneration": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "kind",
          "organizationId",
          "name",
          "description",
          "folder",
          "versionOf",
          "enginePin",
          "version",
          "definition",
          "sourceWorkflowId",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "WorkflowLineage": {
        "type": "object",
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "organizationId": {
                  "type": "string"
                },
                "deleted": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "name",
                "organizationId",
                "deleted"
              ],
              "additionalProperties": false
            }
          },
          "revisions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "workflowId": {
                  "type": "string"
                },
                "parentRevisionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "parent": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "revisionId": {
                          "type": "string"
                        },
                        "workflowId": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "versionLabel": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "revisionId",
                        "workflowId",
                        "organizationId",
                        "name",
                        "versionLabel",
                        "deleted"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "version": {
                  "type": "number"
                },
                "major": {
                  "type": "number"
                },
                "minor": {
                  "type": "number"
                },
                "patch": {
                  "type": "number"
                },
                "versionLabel": {
                  "type": "string"
                },
                "createdBy": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "human",
                    "agent",
                    "automatic",
                    "baseline"
                  ]
                },
                "changeNote": {
                  "type": "string"
                },
                "causalRunId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "causalFeedbackRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "workflowId",
                "parentRevisionId",
                "parent",
                "version",
                "major",
                "minor",
                "patch",
                "versionLabel",
                "createdBy",
                "source",
                "changeNote",
                "causalRunId",
                "causalFeedbackRef",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "workflows",
          "revisions",
          "truncated"
        ],
        "additionalProperties": false
      },
      "SavedWorkflowRevision": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "parentRevisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "parent": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "revisionId": {
                    "type": "string"
                  },
                  "workflowId": {
                    "type": "string"
                  },
                  "organizationId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "versionLabel": {
                    "type": "string"
                  },
                  "deleted": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "revisionId",
                  "workflowId",
                  "organizationId",
                  "name",
                  "versionLabel",
                  "deleted"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "number"
          },
          "major": {
            "type": "number"
          },
          "minor": {
            "type": "number"
          },
          "patch": {
            "type": "number"
          },
          "versionLabel": {
            "type": "string"
          },
          "definition": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "actions": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "name",
              "actions"
            ],
            "additionalProperties": {}
          },
          "fingerprint": {
            "type": "string"
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "human",
              "agent",
              "automatic",
              "baseline"
            ]
          },
          "changeNote": {
            "type": "string"
          },
          "causalRunId": {
            "type": [
              "string",
              "null"
            ]
          },
          "causalFeedbackRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "workflowId",
          "parentRevisionId",
          "parent",
          "version",
          "major",
          "minor",
          "patch",
          "versionLabel",
          "definition",
          "fingerprint",
          "createdBy",
          "source",
          "changeNote",
          "causalRunId",
          "causalFeedbackRef",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "WorkflowRevision": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "workflowId": {
                "type": "string"
              },
              "parentRevisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "parent": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "revisionId": {
                        "type": "string"
                      },
                      "workflowId": {
                        "type": "string"
                      },
                      "organizationId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "versionLabel": {
                        "type": "string"
                      },
                      "deleted": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "revisionId",
                      "workflowId",
                      "organizationId",
                      "name",
                      "versionLabel",
                      "deleted"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "version": {
                "type": "number"
              },
              "major": {
                "type": "number"
              },
              "minor": {
                "type": "number"
              },
              "patch": {
                "type": "number"
              },
              "versionLabel": {
                "type": "string"
              },
              "definition": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "name",
                  "actions"
                ],
                "additionalProperties": {}
              },
              "fingerprint": {
                "type": "string"
              },
              "createdBy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "human",
                  "agent",
                  "automatic",
                  "baseline"
                ]
              },
              "changeNote": {
                "type": "string"
              },
              "causalRunId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "causalFeedbackRef": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "workflowId",
              "parentRevisionId",
              "parent",
              "version",
              "major",
              "minor",
              "patch",
              "versionLabel",
              "definition",
              "fingerprint",
              "createdBy",
              "source",
              "changeNote",
              "causalRunId",
              "causalFeedbackRef",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "revision"
        ],
        "additionalProperties": false
      },
      "WorkflowRevisionList": {
        "type": "object",
        "properties": {
          "revisions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "workflowId": {
                  "type": "string"
                },
                "parentRevisionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "parent": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "revisionId": {
                          "type": "string"
                        },
                        "workflowId": {
                          "type": "string"
                        },
                        "organizationId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "versionLabel": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "revisionId",
                        "workflowId",
                        "organizationId",
                        "name",
                        "versionLabel",
                        "deleted"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "version": {
                  "type": "number"
                },
                "major": {
                  "type": "number"
                },
                "minor": {
                  "type": "number"
                },
                "patch": {
                  "type": "number"
                },
                "versionLabel": {
                  "type": "string"
                },
                "fingerprint": {
                  "type": "string"
                },
                "createdBy": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "human",
                    "agent",
                    "automatic",
                    "baseline"
                  ]
                },
                "changeNote": {
                  "type": "string"
                },
                "causalRunId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "causalFeedbackRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "workflowId",
                "parentRevisionId",
                "parent",
                "version",
                "major",
                "minor",
                "patch",
                "versionLabel",
                "fingerprint",
                "createdBy",
                "source",
                "changeNote",
                "causalRunId",
                "causalFeedbackRef",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "nextBeforeVersion": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "revisions",
          "nextBeforeVersion"
        ],
        "additionalProperties": false
      },
      "WorkflowRevisionWrite": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "const": "saved"
              },
              "organizationId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "folder": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "versionOf": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "enginePin": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "engine": {
                        "type": "string",
                        "const": "fable"
                      },
                      "oliveBudget": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "engine",
                      "oliveBudget"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "version": {
                "type": "number"
              },
              "definition": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "name",
                  "actions"
                ],
                "additionalProperties": {}
              },
              "sourceWorkflowId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdBy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              },
              "revisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "versionLabel": {
                "type": "string"
              },
              "releaseMode": {
                "type": "string",
                "enum": [
                  "legacy",
                  "managed"
                ]
              },
              "productionRevisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "releaseGeneration": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "kind",
              "organizationId",
              "name",
              "description",
              "folder",
              "versionOf",
              "enginePin",
              "version",
              "definition",
              "sourceWorkflowId",
              "createdBy",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          "revision": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "workflowId": {
                "type": "string"
              },
              "parentRevisionId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "parent": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "revisionId": {
                        "type": "string"
                      },
                      "workflowId": {
                        "type": "string"
                      },
                      "organizationId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "versionLabel": {
                        "type": "string"
                      },
                      "deleted": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "revisionId",
                      "workflowId",
                      "organizationId",
                      "name",
                      "versionLabel",
                      "deleted"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "version": {
                "type": "number"
              },
              "major": {
                "type": "number"
              },
              "minor": {
                "type": "number"
              },
              "patch": {
                "type": "number"
              },
              "versionLabel": {
                "type": "string"
              },
              "definition": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "name",
                  "actions"
                ],
                "additionalProperties": {}
              },
              "fingerprint": {
                "type": "string"
              },
              "createdBy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "human",
                  "agent",
                  "automatic",
                  "baseline"
                ]
              },
              "changeNote": {
                "type": "string"
              },
              "causalRunId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "causalFeedbackRef": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "workflowId",
              "parentRevisionId",
              "parent",
              "version",
              "major",
              "minor",
              "patch",
              "versionLabel",
              "definition",
              "fingerprint",
              "createdBy",
              "source",
              "changeNote",
              "causalRunId",
              "causalFeedbackRef",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "saved",
          "revision"
        ],
        "additionalProperties": false
      },
      "WorkflowProduction": {
        "type": "object",
        "properties": {
          "eventsTruncated": {
            "type": "boolean",
            "description": "True when older production audit events were omitted."
          },
          "releaseMode": {
            "type": "string",
            "enum": [
              "legacy",
              "managed"
            ]
          },
          "productionRevisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "generation": {
            "type": "number"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "workflowId": {
                  "type": "string"
                },
                "generation": {
                  "type": "number"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "enable",
                    "disable",
                    "promote",
                    "rollback"
                  ]
                },
                "fromRevisionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "toRevisionId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "releaseMode": {
                  "type": "string",
                  "enum": [
                    "legacy",
                    "managed"
                  ]
                },
                "createdBy": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "changeNote": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "workflowId",
                "generation",
                "action",
                "fromRevisionId",
                "toRevisionId",
                "releaseMode",
                "createdBy",
                "changeNote",
                "createdAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "eventsTruncated",
          "releaseMode",
          "productionRevisionId",
          "generation",
          "events"
        ],
        "additionalProperties": false
      },
      "WorkflowRevisionComparison": {
        "type": "object",
        "properties": {
          "fromRevisionId": {
            "type": "string"
          },
          "toRevisionId": {
            "type": "string"
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "op": {
                  "type": "string",
                  "enum": [
                    "add",
                    "remove",
                    "replace"
                  ]
                },
                "before": {},
                "after": {}
              },
              "required": [
                "path",
                "op",
                "before",
                "after"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "fromRevisionId",
          "toRevisionId",
          "changes"
        ],
        "additionalProperties": false
      },
      "SaveWorkflowRevision": {
        "type": "object",
        "properties": {
          "baseRevisionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "definition": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "actions": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "name",
              "actions"
            ],
            "additionalProperties": {}
          },
          "bump": {
            "type": "string",
            "enum": [
              "patch",
              "minor",
              "major"
            ]
          },
          "changeNote": {
            "type": "string",
            "maxLength": 2000
          },
          "causalRunId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "causalFeedbackRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "baseRevisionId",
          "definition",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "ForkWorkflowRevision": {
        "type": "object",
        "properties": {
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "targetOrganizationId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "changeNote": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "revisionId",
          "name",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "SetWorkflowProduction": {
        "type": "object",
        "properties": {
          "revisionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedProductionRevisionId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedGeneration": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "action": {
            "type": "string",
            "enum": [
              "enable",
              "disable",
              "promote",
              "rollback"
            ]
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "changeNote": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "revisionId",
          "expectedProductionRevisionId",
          "expectedGeneration",
          "action",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "PlacedWorkflow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "placed"
          },
          "name": {
            "type": "string"
          },
          "savedWorkflow": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "version": {
                    "type": [
                      "number",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "version"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "fingerprint": {
            "type": "string"
          },
          "project": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "canvas": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string"
          },
          "inputs": {
            "type": "object",
            "properties": {
              "variables": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scoped to the returned workflow: saved source id or placed canvas id. Copies have new ids."
                    },
                    "name": {
                      "type": "string",
                      "description": "Accepted as a case-insensitive key in run variables; avoids reusing ids across copies."
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "bins": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "fileInput": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                        },
                        "format": {
                          "type": "string",
                          "const": "json"
                        },
                        "cardinality": {
                          "type": "string",
                          "enum": [
                            "one",
                            "many"
                          ]
                        },
                        "defaultFiles": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "storageAssetId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "filename": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "uri": {
                                "type": "string",
                                "maxLength": 2048
                              },
                              "checksum": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sizeBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10485760
                              }
                            },
                            "required": [
                              "id",
                              "storageAssetId",
                              "filename",
                              "uri",
                              "checksum",
                              "sizeBytes"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "format",
                        "cardinality"
                      ],
                      "additionalProperties": false
                    },
                    "assetCount": {
                      "type": "number",
                      "description": "Runnable assets, text notes and variables in this bin and all descendant bins on the same canvas. Folders themselves do not count. Informational: zero does not by itself mean a run is rejected."
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "assetCount"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "variables",
              "bins"
            ],
            "additionalProperties": false
          },
          "links": {
            "type": "object",
            "properties": {
              "runs": {
                "type": "string"
              }
            },
            "required": [
              "runs"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "savedWorkflow",
          "fingerprint",
          "project",
          "canvas",
          "createdAt",
          "inputs",
          "links"
        ],
        "additionalProperties": false
      },
      "CreateWorkflow": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "The saved workflow to place."
          },
          "revisionId": {
            "description": "Exact immutable version to edit. Omitted: the current editable head.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "projectId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "The project to place it in; the key must be able to edit it."
          },
          "canvasId": {
            "description": "Target canvas; omitted → a new canvas named after the workflow.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "description": "Name for the placed copy.",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        },
        "required": [
          "from",
          "projectId"
        ],
        "additionalProperties": false
      },
      "CreateRun": {
        "type": "object",
        "properties": {
          "revisionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "production": {
            "type": "boolean",
            "const": true
          },
          "compile": {
            "description": "Fable only: build and dry-test scripts without generating media. Pass oliveBudget: 0. Run the compiled placed workflow afterwards, or save it as a new version for future saved-workflow runs.",
            "type": "boolean"
          },
          "oliveBudget": {
            "description": "Cap on what this run may spend, in olives. An explicit engine: \"fable\" request defaults to 1,000 olives when omitted and returns DEFAULT_OLIVE_BUDGET_APPLIED in warnings.",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000
          },
          "idempotencyKey": {
            "description": "Re-posting the same key with the same body returns the run the first call created.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "name": {
            "description": "For a saved workflow, names its new run canvas (default: '<workflow name> · <UTC date time>'), so parallel runs are told apart; the run keeps the workflow's name. For a placed workflow, names the run.",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "variables": {
            "description": "Values for the variables the workflow's Actions read, keyed by variable name (case-insensitive) or id.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "inputs": {
            "description": "JSON file inputs keyed by their stable input key. Use { json: value } or { fileId: id }.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "json": {},
                        "filename": {
                          "type": "string",
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "json"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "fileId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        }
                      },
                      "required": [
                        "fileId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                {
                  "minItems": 1,
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "json": {},
                          "filename": {
                            "type": "string",
                            "maxLength": 200
                          }
                        },
                        "required": [
                          "json"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "fileId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          }
                        },
                        "required": [
                          "fileId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              ]
            }
          },
          "bins": {
            "description": "Optional replacements keyed by input-bin name (case-insensitive) or id. Omit a bin to use its saved preset (saved workflow) or current contents (placed workflow). A supplied array replaces that bin; [] explicitly empties a media bin. JSON file inputs still require files. Only saved bins marked required need caller input. JSON file inputs can use inputs or saved default files. Each entry is an asset id, or a file to import first: a public https:// URL (up to 50 MB), a base64 data: URI (10 MB image, 30 MB MP4, 15 MB MP3/WAV, decoded), or { url, filename } for either. File inputs are for saved workflows (a placed workflow takes asset ids); imports land in the key’s default project, and the run starts once every import has processed (up to 60 s), at most 20 per run. The whole request body is capped at 41 MB, so several large files are better passed as URLs or uploads. A failed import answers WORKFLOW_INPUT_FETCH_FAILED and starts nothing.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "additionalProperties": {
              "maxItems": 200,
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "An asset id (from GET /v1/runs/{runId}/results, or a finished upload)."
                  },
                  {
                    "type": "string",
                    "pattern": "^(https:\\/\\/|data:)",
                    "description": "A public https:// URL or a base64 data: URI. Martini imports it into the key’s workspace before the run starts."
                  },
                  {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "pattern": "^(https:\\/\\/|data:)",
                        "description": "A public https:// URL or a base64 data: URI."
                      },
                      "filename": {
                        "description": "The imported asset's filename; defaults to the URL's last path segment, or a name from the type.",
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          },
          "fingerprint": {
            "description": "The fingerprint last read for this workflow; the run is refused with WORKFLOW_CHANGED when it no longer matches.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "projectId": {
            "description": "Destination only, for saved workflows: store the new execution canvas in this project. Omit to use Workflow runs. The saved workflow ID still selects the definition and presets; this field never selects a source workflow or adopts project contents.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "engine": {
            "description": "Which engine drives the run. Omitted: the saved workflow's pin, else Workflow Beta (\"fable\"), one autonomous session running the workflow's compiled scripts. \"harness\" is the classic per-Action engine, the only one that supports resume. A Beta run with no oliveBudget gets 1,000 olives and a DEFAULT_OLIVE_BUDGET_APPLIED warning.",
            "type": "string",
            "enum": [
              "fable",
              "harness"
            ]
          }
        },
        "additionalProperties": false
      },
      "WorkflowRun": {
        "type": "object",
        "properties": {
          "billing": {
            "type": "object",
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "policyVersion": {
                "type": "string"
              },
              "rateVersion": {
                "type": "string"
              },
              "budgetPolicy": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "funding_required",
                  "reconciliation_required",
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "estimatedOlives": {
                "type": "number"
              },
              "accruedOlives": {
                "type": "number"
              },
              "reservedOlives": {
                "type": "number"
              },
              "chargedOlives": {
                "type": "number"
              },
              "resources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "model",
                        "compute",
                        "tool"
                      ]
                    },
                    "accruedOlives": {
                      "type": "number"
                    },
                    "unmetered": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "kind",
                    "accruedOlives",
                    "unmetered"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "sessionId",
              "policyVersion",
              "rateVersion",
              "budgetPolicy",
              "status",
              "estimatedOlives",
              "accruedOlives",
              "reservedOlives",
              "chargedOlives",
              "resources"
            ],
            "additionalProperties": false
          },
          "warnings": {
            "description": "Non-blocking caveats, accumulated across attempts. Absence means none. Never changes status or clears errors.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "actionId": {
                  "description": "Null for a warning about the whole run.",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "code",
                "message",
                "actionId"
              ],
              "additionalProperties": false
            }
          },
          "compile": {
            "description": "True for a script build, which generates no media.",
            "type": "boolean"
          },
          "thenRunId": {
            "description": "Present only when a build will automatically start execution. Null until handoff: keep polling this build, including after completed, until the execution id appears. Then poll /v1/runs/{thenRunId} for media results. Absent for build-only requests.",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "savedWorkflow": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "version": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "revisionId": {
                    "type": "string"
                  },
                  "versionLabel": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "version"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "fingerprint": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "project": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "canvas": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "awaiting_approval",
              "running",
              "paused",
              "completed",
              "failed",
              "needs_revision",
              "cancelled"
            ]
          },
          "phase": {
            "description": "What Martini is doing right now (\"unit 3/7 · waiting on generations\"), the line the app shows. Display copy, not parseable; null unless the run is running.",
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "ui",
              "chat",
              "mcp",
              "api"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "model_provider_unavailable"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Why a failed run failed, as a stable code to branch on; `error` carries the copy for a human. Null unless the run failed and Martini can name the cause. `model_provider_unavailable`: the AI model provider (Anthropic) kept failing or could not be reached, so the run stopped. The workflow and its inputs did not cause it: start the run again."
          },
          "variables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "bins": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "olives": {
            "type": "object",
            "properties": {
              "budget": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "budgetSource": {
                "type": "string",
                "enum": [
                  "explicit",
                  "auto"
                ]
              },
              "generation": {
                "type": "number"
              },
              "agent": {
                "type": "number",
                "description": "The run's agent-work spending: the `billing` receipt's figure when the run has one (accrued while the session is open, charged once it is settled), else the run's own measurement. Reserved olives are holds and are not counted."
              }
            },
            "required": [
              "budget",
              "budgetSource",
              "generation",
              "agent"
            ],
            "additionalProperties": false
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "outcome": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "generated",
                        "failed",
                        "needs_revision"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The settled result beside `status`: null until settled, then generated, failed, or needs_revision."
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "warnings": {
                  "description": "Non-blocking caveats, accumulated across attempts. Absence means none. Never changes status or clears errors.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "actionId": {
                        "description": "Null for a warning about the whole run.",
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "code",
                      "message",
                      "actionId"
                    ],
                    "additionalProperties": false
                  }
                },
                "startedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "completedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "plan": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "units": {
                          "type": "number",
                          "description": "How many units (agent sessions) the step runs."
                        },
                        "outputsPerUnit": {
                          "type": "number"
                        },
                        "estimatedOlives": {
                          "type": "number"
                        },
                        "summary": {
                          "type": "string",
                          "description": "One human sentence of how the brief was read."
                        }
                      },
                      "required": [
                        "units",
                        "outputsPerUnit",
                        "estimatedOlives",
                        "summary"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The plan pass's reading of the step; null before it has run."
                },
                "olives": {
                  "type": "object",
                  "properties": {
                    "generation": {
                      "type": "number"
                    },
                    "agent": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "generation",
                    "agent"
                  ],
                  "additionalProperties": false,
                  "description": "`generation` is the step's spend summed from its takes; `agent` is the step's own measurement, not a share of the run-level `olives.agent`."
                },
                "events": {
                  "description": "The step's activity trail; present only with `?include=activity`. A finished step's events never change.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "elapsedMs": {
                        "type": "number",
                        "description": "Milliseconds since the step began executing."
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "plan",
                          "tool",
                          "unit",
                          "revision",
                          "settle",
                          "judge",
                          "sweep",
                          "note",
                          "turn"
                        ]
                      },
                      "tool": {
                        "description": "The tool the agent called, for `tool` events.",
                        "type": "string"
                      },
                      "unit": {
                        "description": "1-based unit number within the step.",
                        "type": "number"
                      },
                      "take": {
                        "type": "number"
                      },
                      "durationMs": {
                        "type": "number"
                      },
                      "note": {
                        "type": "string"
                      },
                      "detail": {
                        "description": "Call summary for computer tools (the exec command / written path).",
                        "type": "string"
                      },
                      "outputAssetIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "elapsedMs",
                      "kind"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "name",
                "status",
                "outcome",
                "error",
                "startedAt",
                "completedAt",
                "plan",
                "olives"
              ],
              "additionalProperties": false
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "actionId": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "outcome": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "generated",
                        "failed",
                        "needs_revision"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "outputAssetId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "revision": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "reason": {
                          "type": "string"
                        },
                        "inputRefs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "reason",
                        "inputRefs"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The agent's revision request when `outcome` is `needs_revision`; null on every other item."
                },
                "createdAt": {
                  "type": "string"
                },
                "completedAt": {
                  "description": "When the take settled (completed, failed, rejected, or declined); null while it is still open.",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "verdict": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "pass": {
                          "type": "boolean"
                        },
                        "reason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "take": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "pass",
                        "reason",
                        "take"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The judge's call on this take; null when the step had no judge."
                },
                "replacesItemId": {
                  "description": "The take this one replaced (a retake), or null.",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "actionId",
                "status",
                "outcome",
                "outputAssetId",
                "error",
                "revision",
                "createdAt",
                "completedAt",
                "verdict",
                "replacesItemId"
              ],
              "additionalProperties": false
            }
          },
          "openInMartini": {
            "type": "string"
          },
          "links": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string"
              },
              "results": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "results"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "savedWorkflow",
          "fingerprint",
          "status",
          "phase",
          "origin",
          "createdAt",
          "startedAt",
          "completedAt",
          "error",
          "errorCode",
          "variables",
          "bins",
          "olives",
          "actions",
          "items",
          "openInMartini",
          "links"
        ],
        "additionalProperties": false
      },
      "WorkflowRunStatus": {
        "type": "object",
        "properties": {
          "warnings": {
            "description": "Non-blocking caveats, accumulated across attempts. Absence means none. Never changes status or clears errors.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "actionId": {
                  "description": "Null for a warning about the whole run.",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "code",
                "message",
                "actionId"
              ],
              "additionalProperties": false
            }
          },
          "runId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "awaiting_approval",
              "running",
              "paused",
              "completed",
              "failed",
              "needs_revision",
              "cancelled"
            ]
          },
          "phase": {
            "type": [
              "string",
              "null"
            ]
          },
          "progress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "stage": {
                    "type": "string",
                    "enum": [
                      "starting",
                      "planning",
                      "executing",
                      "generating",
                      "reviewing",
                      "recovering",
                      "finalizing"
                    ]
                  },
                  "operation": {
                    "type": "string",
                    "description": "Last observed operation; current only while status is running."
                  },
                  "lastActivityAt": {
                    "type": "string",
                    "description": "ISO time of execution activity. Lease renewals do not refresh it."
                  },
                  "actionId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "executorModel": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "activeUnitCount": {
                    "type": "number"
                  },
                  "queuedUnitCount": {
                    "type": "number"
                  },
                  "pendingOutputCount": {
                    "type": "number"
                  },
                  "units": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "unitIndex": {
                          "type": "number"
                        },
                        "take": {
                          "type": "number"
                        },
                        "stage": {
                          "type": "string",
                          "enum": [
                            "starting",
                            "planning",
                            "executing",
                            "generating",
                            "reviewing",
                            "recovering",
                            "finalizing"
                          ]
                        },
                        "operation": {
                          "type": "string"
                        },
                        "stepsCompleted": {
                          "type": "number"
                        },
                        "stepLimit": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "unitIndex",
                        "take",
                        "stage",
                        "operation",
                        "stepsCompleted",
                        "stepLimit"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "recentActivity": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "at": {
                          "type": "string"
                        },
                        "operation": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "at",
                        "operation"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "stage",
                  "operation",
                  "lastActivityAt",
                  "actionId",
                  "executorModel",
                  "activeUnitCount",
                  "queuedUnitCount",
                  "pendingOutputCount",
                  "units",
                  "recentActivity"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "currentAction": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "index": {
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "index"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "actions": {
            "type": "object",
            "properties": {
              "completed": {
                "type": "number"
              },
              "pending": {
                "type": "number"
              },
              "total": {
                "type": "number"
              }
            },
            "required": [
              "completed",
              "pending",
              "total"
            ],
            "additionalProperties": false
          },
          "outputs": {
            "type": "object",
            "properties": {
              "delivered": {
                "type": "number"
              },
              "accepted": {
                "type": "number"
              },
              "rejected": {
                "type": "number"
              },
              "failed": {
                "type": "number"
              },
              "needsRevision": {
                "type": "number",
                "description": "Units the agent ended on purpose because the inputs need to change; see items[].revision on the run."
              },
              "pending": {
                "type": "number"
              },
              "planned": {
                "type": "number",
                "description": "Outputs in plans derived so far; not a required-shot completeness guarantee."
              },
              "plannedActions": {
                "type": "number"
              }
            },
            "required": [
              "delivered",
              "accepted",
              "rejected",
              "failed",
              "needsRevision",
              "pending",
              "planned",
              "plannedActions"
            ],
            "additionalProperties": false
          },
          "olives": {
            "type": "object",
            "properties": {
              "budget": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "generation": {
                "type": "number"
              },
              "agent": {
                "type": "number",
                "description": "The run's agent-work spending: the `billing` receipt's figure when the run has one (accrued while open, charged once settled), else the run's own measurement."
              }
            },
            "required": [
              "budget",
              "generation",
              "agent"
            ],
            "additionalProperties": false
          },
          "errorMessage": {
            "type": [
              "string",
              "null"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "model_provider_unavailable"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Why a failed run failed, as a stable code to branch on; `error` carries the copy for a human. Null unless the run failed and Martini can name the cause. `model_provider_unavailable`: the AI model provider (Anthropic) kept failing or could not be reached, so the run stopped. The workflow and its inputs did not cause it: start the run again."
          },
          "engine": {
            "description": "Which engine drives the run.",
            "type": "string",
            "enum": [
              "fable",
              "harness"
            ]
          },
          "compile": {
            "description": "True for a script build, which generates no media.",
            "type": "boolean"
          },
          "thenRunId": {
            "description": "Present only when a build will automatically start execution. Null until handoff: keep polling this build, including after completed, until the execution id appears. Then poll /v1/runs/{thenRunId} for media results. Absent for build-only requests.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "runId",
          "status",
          "phase",
          "progress",
          "currentAction",
          "actions",
          "outputs",
          "olives",
          "errorMessage"
        ],
        "additionalProperties": false
      },
      "WorkflowResults": {
        "type": "object",
        "properties": {
          "warnings": {
            "description": "Non-blocking caveats, accumulated across attempts. Absence means none. Never changes status or clears errors.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "actionId": {
                  "description": "Null for a warning about the whole run.",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "code",
                "message",
                "actionId"
              ],
              "additionalProperties": false
            }
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "awaiting_approval",
              "running",
              "paused",
              "completed",
              "failed",
              "needs_revision",
              "cancelled"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "model_provider_unavailable"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Why a failed run failed, as a stable code to branch on; `error` carries the copy for a human. Null unless the run failed and Martini can name the cause. `model_provider_unavailable`: the AI model provider (Anthropic) kept failing or could not be reached, so the run stopped. The workflow and its inputs did not cause it: start the run again."
          },
          "outputs": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "itemId": {
                      "type": "string"
                    },
                    "actionId": {
                      "type": "string"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "bin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The canvas bin the output sits in on the run’s canvas (for example \"Final delivery\"), named as the workflow’s author named it; null when it sits loose on the canvas. Use it to tell outputs apart without mapping steps."
                    },
                    "status": {
                      "type": "string",
                      "const": "ready"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "Presigned download URL, valid for `expiresIn` seconds."
                    },
                    "expiresIn": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "itemId",
                    "actionId",
                    "assetId",
                    "bin",
                    "status",
                    "filename",
                    "mimeType",
                    "url",
                    "expiresIn"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "itemId": {
                      "type": "string"
                    },
                    "actionId": {
                      "type": "string"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "bin": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The canvas bin the output sits in on the run’s canvas (for example \"Final delivery\"), named as the workflow’s author named it; null when it sits loose on the canvas. Use it to tell outputs apart without mapping steps."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "not_ready",
                        "missing"
                      ],
                      "description": "`not_ready`: the take exists but its file has not settled yet. `missing`: the asset is no longer in the project or its file is gone; `error` says which."
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "itemId",
                    "actionId",
                    "assetId",
                    "bin",
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "One entry per settled output file. Text notes a step wrote as outputs have no file and are left out."
          },
          "links": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string"
              },
              "results": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "results"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "status",
          "error",
          "errorCode",
          "outputs",
          "links"
        ],
        "additionalProperties": false
      },
      "Asset": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string"
          },
          "projectId": {
            "type": "string"
          },
          "canvasId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "uploading",
              "queued",
              "processing",
              "completed",
              "failed"
            ]
          },
          "assetType": {
            "type": "string",
            "enum": [
              "video",
              "audio",
              "image",
              "set",
              "file"
            ]
          },
          "url": {
            "description": "The durable Martini URL to use in generation media fields once completed.",
            "type": [
              "string",
              "null"
            ]
          },
          "proxyUrl": {
            "type": "string"
          },
          "thumbnailUrl": {
            "type": "string"
          },
          "waveformUrl": {
            "type": "string"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "duration": {
            "type": "number"
          },
          "fileSizeBytes": {
            "type": "number"
          },
          "contentType": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "canvasPosition": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              }
            },
            "required": [
              "x",
              "y"
            ],
            "additionalProperties": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "assetId",
          "projectId",
          "canvasId",
          "status",
          "url",
          "contentType"
        ],
        "additionalProperties": false
      },
      "PrepareUploadRequest": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "type": "string",
                  "minLength": 1
                },
                "contentType": {
                  "type": "string",
                  "enum": [
                    "image/jpeg",
                    "image/png",
                    "image/webp",
                    "video/mp4",
                    "audio/mpeg",
                    "audio/mp3",
                    "audio/wav",
                    "audio/x-wav"
                  ],
                  "description": "Images up to 10 MB, MP4 up to 200 MB in one PUT (up to 2 GiB with `multipart`), MP3/WAV up to 15 MB."
                },
                "sizeBytes": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "multipart": {
                  "description": "Send this file in parts. From 16 MiB the result carries a `multipart` plan instead of an `uploadUrl`; below that it is the usual single PUT. A video over 200 MB must set this.",
                  "type": "boolean"
                },
                "canvasPosition": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "x",
                    "y"
                  ]
                },
                "lineage": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "description": "What was done to make this file: trim, concat, mix, crop, inpaint, annotate, transcode, copy, import, upload — or free text such as 'photoshop' or 'pdf-extract'. Defaults to upload.",
                      "type": "string",
                      "maxLength": 64
                    },
                    "tool": {
                      "description": "The program or model that did it, e.g. { kind: \"external\", id: \"ffmpeg\", version: \"7.1\" }.",
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "model",
                            "martini",
                            "external"
                          ]
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "version": {
                          "type": "string",
                          "maxLength": 64
                        },
                        "provider": {
                          "type": "string",
                          "maxLength": 64
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "inputs": {
                      "description": "What the file was made from, in order. A file from the user's disk is [{ external: { filename } }]; a trim of a board asset is [{ nodeId, role: 'source', region: { startSec, endSec } }]. [] means nothing is known.",
                      "maxItems": 2000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "nodeId": {
                            "description": "A board asset this file was made from — its assetId from get_board_assets or a download result.",
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "external": {
                            "description": "Bytes that did not come from a board asset. Use nodeId for board assets instead.",
                            "type": "object",
                            "properties": {
                              "url": {
                                "description": "Where the bytes came from outside Martini, or a Martini file URL.",
                                "type": "string",
                                "maxLength": 2048
                              },
                              "filename": {
                                "description": "The file on the user's disk or inside a document (e.g. deck.pdf).",
                                "type": "string",
                                "maxLength": 255
                              }
                            },
                            "additionalProperties": false
                          },
                          "role": {
                            "description": "What the input was for: source (default), start-frame, end-frame, reference, element, style, audio, video, mask.",
                            "type": "string",
                            "maxLength": 64
                          },
                          "region": {
                            "description": "The part of the input that was used — a timestamp, a window, a rectangle. Makes a trim or crop replayable.",
                            "type": "object",
                            "properties": {
                              "timeSec": {
                                "description": "A single frame time in the input, in seconds.",
                                "type": "number",
                                "minimum": 0
                              },
                              "startSec": {
                                "description": "Window start in the input, in seconds (with endSec).",
                                "type": "number",
                                "minimum": 0
                              },
                              "endSec": {
                                "description": "Window end in the input, in seconds (with startSec).",
                                "type": "number",
                                "minimum": 0
                              },
                              "rect": {
                                "description": "Crop rectangle in natural pixels of the input.",
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  },
                                  "width": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  },
                                  "height": {
                                    "type": "number",
                                    "exclusiveMinimum": 0
                                  }
                                },
                                "required": [
                                  "x",
                                  "y",
                                  "width",
                                  "height"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "note": {
                      "description": "One line for humans: why, or which part (\"page 4 of deck.pdf\", \"trimmed to 20 s for the FLUX upscale limit\").",
                      "type": "string",
                      "maxLength": 2000
                    },
                    "withheld": {
                      "description": "ONLY when the user explicitly asked you not to record lineage for this upload. Quote their instruction as the reason. Never use it on your own initiative.",
                      "type": "object",
                      "properties": {
                        "reason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        }
                      },
                      "required": [
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false,
                  "description": "Where these bytes came from. Fill it to the best of your knowledge on every upload: the board assets it was made from (nodeId), the external file or URL, the operation and the tool. Minimal block for a file from the user's disk: { inputs: [{ external: { filename: 'IMG_4021.jpg' } }] }. Download results include a ready lineageStub to paste here when you upload something made from a Martini asset. Only when the user explicitly asks you not to record lineage may you send { withheld: { reason } }."
                }
              },
              "required": [
                "filename",
                "contentType",
                "sizeBytes"
              ]
            }
          },
          "projectId": {
            "description": "Upload into another project the key can edit. Requires canvasId; the pair defaults to the key’s.",
            "type": "string"
          },
          "canvasId": {
            "description": "Requires projectId.",
            "type": "string"
          }
        },
        "required": [
          "files"
        ],
        "dependentRequired": {
          "projectId": [
            "canvasId"
          ],
          "canvasId": [
            "projectId"
          ]
        }
      },
      "PrepareUploadResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "index": {
                      "type": "number"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "projectId": {
                      "type": "string"
                    },
                    "canvasId": {
                      "type": "string"
                    },
                    "uploadUrl": {
                      "description": "Presigned PUT URL; send the bytes here with `uploadHeaders`. Null when `multipart` is present.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "uploadHeaders": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "directUpload": {
                      "type": "boolean"
                    },
                    "multipart": {
                      "description": "Present when the file asked for parts and is large enough to need them; PUT each part, then complete.",
                      "type": "object",
                      "properties": {
                        "uploadToken": {
                          "type": "string",
                          "description": "Hand this back to complete (and abort) with the parts’ ETags."
                        },
                        "partSize": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Bytes per part; the last part is shorter."
                        },
                        "partCount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "partNumber": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991,
                                "description": "1-based."
                              },
                              "url": {
                                "type": "string",
                                "description": "Presigned PUT URL for this part. Send the part’s bytes with no extra headers; keep the response’s `ETag` header, quotes included."
                              }
                            },
                            "required": [
                              "partNumber",
                              "url"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "expiresIn": {
                          "type": "number",
                          "description": "Seconds until the part URLs stop working."
                        }
                      },
                      "required": [
                        "uploadToken",
                        "partSize",
                        "partCount",
                        "parts",
                        "expiresIn"
                      ],
                      "additionalProperties": false
                    },
                    "expiresIn": {
                      "type": "number"
                    },
                    "assetNumber": {
                      "type": "number"
                    },
                    "url": {
                      "type": "string"
                    },
                    "canvasPosition": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "x",
                        "y"
                      ],
                      "additionalProperties": false
                    },
                    "assetType": {
                      "type": "string",
                      "enum": [
                        "video",
                        "audio",
                        "image"
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "filename",
                    "assetId",
                    "projectId",
                    "canvasId",
                    "uploadUrl",
                    "uploadHeaders",
                    "directUpload",
                    "expiresIn",
                    "assetNumber",
                    "url",
                    "canvasPosition",
                    "assetType"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": false
                    },
                    "index": {
                      "type": "number"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "MISSING_FIELDS",
                        "INVALID_SIZE",
                        "INVALID_FORMAT",
                        "FILE_TOO_LARGE",
                        "SIZE_EXCEEDED",
                        "INVALID_FILENAME",
                        "AUDIO_EXTENSION_MISMATCH",
                        "STORAGE_UNAVAILABLE",
                        "UPLOAD_CAPACITY_EXCEEDED",
                        "MULTIPART_REQUIRED"
                      ],
                      "description": "Why this file was refused."
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "filename",
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false
      },
      "CompleteUploadRequest": {
        "type": "object",
        "properties": {
          "assetIds": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "projectId": {
            "type": "string"
          },
          "multipart": {
            "description": "For each asset sent in parts: the plan’s token and every part’s ETag.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "assetId": {
                  "type": "string",
                  "description": "Also listed in `assetIds`."
                },
                "uploadToken": {
                  "type": "string",
                  "description": "The plan’s `uploadToken` from prepare."
                },
                "parts": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "partNumber": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "etag": {
                        "type": "string",
                        "description": "The part response’s `ETag` header, quotes included."
                      }
                    },
                    "required": [
                      "partNumber",
                      "etag"
                    ]
                  }
                }
              },
              "required": [
                "assetId",
                "uploadToken",
                "parts"
              ]
            }
          }
        },
        "required": [
          "assetIds"
        ]
      },
      "CompleteUploadResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "index": {
                      "type": "number"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "projectId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "processing",
                        "completed"
                      ]
                    },
                    "url": {
                      "type": "string"
                    },
                    "assetType": {
                      "type": "string",
                      "enum": [
                        "video",
                        "audio",
                        "image"
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "assetId",
                    "projectId",
                    "status",
                    "url",
                    "assetType"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": false
                    },
                    "index": {
                      "type": "number"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "ASSET_NOT_FOUND",
                        "ALREADY_PROCESSED",
                        "UPLOAD_NOT_RECEIVED",
                        "UPLOAD_MIME_MISMATCH",
                        "IMAGE_DECODE_FAILED",
                        "SIZE_EXCEEDED",
                        "MULTIPART_INVALID_PARTS",
                        "MULTIPART_COMPLETE_FAILED",
                        "MULTIPART_UPLOAD_GONE",
                        "MULTIPART_UNAVAILABLE",
                        "UPLOAD_TOKEN_INVALID"
                      ],
                      "description": "Why this asset could not be completed."
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "assetId",
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false
      },
      "AbortUploadRequest": {
        "type": "object",
        "properties": {
          "uploads": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "assetId": {
                  "type": "string"
                },
                "uploadToken": {
                  "description": "The plan’s `uploadToken`, when the upload was sent in parts.",
                  "type": "string"
                }
              },
              "required": [
                "assetId"
              ]
            }
          },
          "projectId": {
            "type": "string"
          }
        },
        "required": [
          "uploads"
        ]
      },
      "AbortUploadResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "index": {
                      "type": "number"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "aborted"
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "assetId",
                    "status"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": false
                    },
                    "index": {
                      "type": "number"
                    },
                    "assetId": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "ASSET_NOT_FOUND",
                        "ALREADY_PROCESSED",
                        "UPLOAD_TOKEN_INVALID",
                        "MULTIPART_ABORT_FAILED"
                      ],
                      "description": "Why this upload could not be aborted."
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "index",
                    "assetId",
                    "code",
                    "message"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false
      },
      "Base64UploadRequest": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1
          },
          "contentType": {
            "type": "string",
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp",
              "video/mp4",
              "audio/mpeg",
              "audio/mp3",
              "audio/wav",
              "audio/x-wav"
            ]
          },
          "data": {
            "type": "string",
            "description": "Base64 (or a data: URL). Caps: 10 MB image, 30 MB MP4, 15 MB MP3/WAV, decoded."
          },
          "projectId": {
            "description": "Requires canvasId; the pair defaults to the key’s.",
            "type": "string"
          },
          "canvasId": {
            "description": "Requires projectId.",
            "type": "string"
          },
          "canvasPosition": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              }
            },
            "required": [
              "x",
              "y"
            ]
          },
          "lineage": {
            "type": "object",
            "properties": {
              "operation": {
                "description": "What was done to make this file: trim, concat, mix, crop, inpaint, annotate, transcode, copy, import, upload — or free text such as 'photoshop' or 'pdf-extract'. Defaults to upload.",
                "type": "string",
                "maxLength": 64
              },
              "tool": {
                "description": "The program or model that did it, e.g. { kind: \"external\", id: \"ffmpeg\", version: \"7.1\" }.",
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "model",
                      "martini",
                      "external"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "provider": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "kind",
                  "id"
                ],
                "additionalProperties": false
              },
              "inputs": {
                "description": "What the file was made from, in order. A file from the user's disk is [{ external: { filename } }]; a trim of a board asset is [{ nodeId, role: 'source', region: { startSec, endSec } }]. [] means nothing is known.",
                "maxItems": 2000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "nodeId": {
                      "description": "A board asset this file was made from — its assetId from get_board_assets or a download result.",
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "external": {
                      "description": "Bytes that did not come from a board asset. Use nodeId for board assets instead.",
                      "type": "object",
                      "properties": {
                        "url": {
                          "description": "Where the bytes came from outside Martini, or a Martini file URL.",
                          "type": "string",
                          "maxLength": 2048
                        },
                        "filename": {
                          "description": "The file on the user's disk or inside a document (e.g. deck.pdf).",
                          "type": "string",
                          "maxLength": 255
                        }
                      },
                      "additionalProperties": false
                    },
                    "role": {
                      "description": "What the input was for: source (default), start-frame, end-frame, reference, element, style, audio, video, mask.",
                      "type": "string",
                      "maxLength": 64
                    },
                    "region": {
                      "description": "The part of the input that was used — a timestamp, a window, a rectangle. Makes a trim or crop replayable.",
                      "type": "object",
                      "properties": {
                        "timeSec": {
                          "description": "A single frame time in the input, in seconds.",
                          "type": "number",
                          "minimum": 0
                        },
                        "startSec": {
                          "description": "Window start in the input, in seconds (with endSec).",
                          "type": "number",
                          "minimum": 0
                        },
                        "endSec": {
                          "description": "Window end in the input, in seconds (with startSec).",
                          "type": "number",
                          "minimum": 0
                        },
                        "rect": {
                          "description": "Crop rectangle in natural pixels of the input.",
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            },
                            "width": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            },
                            "height": {
                              "type": "number",
                              "exclusiveMinimum": 0
                            }
                          },
                          "required": [
                            "x",
                            "y",
                            "width",
                            "height"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              },
              "note": {
                "description": "One line for humans: why, or which part (\"page 4 of deck.pdf\", \"trimmed to 20 s for the FLUX upscale limit\").",
                "type": "string",
                "maxLength": 2000
              },
              "withheld": {
                "description": "ONLY when the user explicitly asked you not to record lineage for this upload. Quote their instruction as the reason. Never use it on your own initiative.",
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "additionalProperties": false,
            "description": "Where these bytes came from. Fill it to the best of your knowledge on every upload: the board assets it was made from (nodeId), the external file or URL, the operation and the tool. Minimal block for a file from the user's disk: { inputs: [{ external: { filename: 'IMG_4021.jpg' } }] }. Download results include a ready lineageStub to paste here when you upload something made from a Martini asset. Only when the user explicitly asks you not to record lineage may you send { withheld: { reason } }."
          }
        },
        "required": [
          "filename",
          "contentType",
          "data"
        ],
        "dependentRequired": {
          "projectId": [
            "canvasId"
          ],
          "canvasId": [
            "projectId"
          ]
        }
      },
      "Base64UploadResponse": {
        "type": "object",
        "properties": {
          "asset": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "type": "boolean",
                    "const": true
                  },
                  "index": {
                    "type": "number"
                  },
                  "assetId": {
                    "type": "string"
                  },
                  "projectId": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "processing",
                      "completed"
                    ]
                  },
                  "url": {
                    "type": "string"
                  },
                  "assetType": {
                    "type": "string",
                    "enum": [
                      "video",
                      "audio",
                      "image"
                    ]
                  }
                },
                "required": [
                  "ok",
                  "index",
                  "assetId",
                  "projectId",
                  "status",
                  "url",
                  "assetType"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "type": "boolean",
                    "const": false
                  },
                  "index": {
                    "type": "number"
                  },
                  "assetId": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "enum": [
                      "ASSET_NOT_FOUND",
                      "ALREADY_PROCESSED",
                      "UPLOAD_NOT_RECEIVED",
                      "UPLOAD_MIME_MISMATCH",
                      "IMAGE_DECODE_FAILED",
                      "SIZE_EXCEEDED",
                      "MULTIPART_INVALID_PARTS",
                      "MULTIPART_COMPLETE_FAILED",
                      "MULTIPART_UPLOAD_GONE",
                      "MULTIPART_UNAVAILABLE",
                      "UPLOAD_TOKEN_INVALID"
                    ],
                    "description": "Why this asset could not be completed."
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "ok",
                  "index",
                  "assetId",
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            ]
          },
          "prepare": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "type": "boolean",
                    "const": true
                  },
                  "index": {
                    "type": "number"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "assetId": {
                    "type": "string"
                  },
                  "projectId": {
                    "type": "string"
                  },
                  "canvasId": {
                    "type": "string"
                  },
                  "uploadUrl": {
                    "description": "Presigned PUT URL; send the bytes here with `uploadHeaders`. Null when `multipart` is present.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "uploadHeaders": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "directUpload": {
                    "type": "boolean"
                  },
                  "multipart": {
                    "description": "Present when the file asked for parts and is large enough to need them; PUT each part, then complete.",
                    "type": "object",
                    "properties": {
                      "uploadToken": {
                        "type": "string",
                        "description": "Hand this back to complete (and abort) with the parts’ ETags."
                      },
                      "partSize": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991,
                        "description": "Bytes per part; the last part is shorter."
                      },
                      "partCount": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "parts": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "partNumber": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "1-based."
                            },
                            "url": {
                              "type": "string",
                              "description": "Presigned PUT URL for this part. Send the part’s bytes with no extra headers; keep the response’s `ETag` header, quotes included."
                            }
                          },
                          "required": [
                            "partNumber",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "expiresIn": {
                        "type": "number",
                        "description": "Seconds until the part URLs stop working."
                      }
                    },
                    "required": [
                      "uploadToken",
                      "partSize",
                      "partCount",
                      "parts",
                      "expiresIn"
                    ],
                    "additionalProperties": false
                  },
                  "expiresIn": {
                    "type": "number"
                  },
                  "assetNumber": {
                    "type": "number"
                  },
                  "url": {
                    "type": "string"
                  },
                  "canvasPosition": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "x",
                      "y"
                    ],
                    "additionalProperties": false
                  },
                  "assetType": {
                    "type": "string",
                    "enum": [
                      "video",
                      "audio",
                      "image"
                    ]
                  }
                },
                "required": [
                  "ok",
                  "index",
                  "filename",
                  "assetId",
                  "projectId",
                  "canvasId",
                  "uploadUrl",
                  "uploadHeaders",
                  "directUpload",
                  "expiresIn",
                  "assetNumber",
                  "url",
                  "canvasPosition",
                  "assetType"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "ok": {
                    "type": "boolean",
                    "const": false
                  },
                  "index": {
                    "type": "number"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string",
                    "enum": [
                      "MISSING_FIELDS",
                      "INVALID_SIZE",
                      "INVALID_FORMAT",
                      "FILE_TOO_LARGE",
                      "SIZE_EXCEEDED",
                      "INVALID_FILENAME",
                      "AUDIO_EXTENSION_MISMATCH",
                      "STORAGE_UNAVAILABLE",
                      "UPLOAD_CAPACITY_EXCEEDED",
                      "MULTIPART_REQUIRED"
                    ],
                    "description": "Why this file was refused."
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "ok",
                  "index",
                  "filename",
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            ],
            "description": "Where the asset was placed. The bytes are already stored, so there is nothing to upload: `uploadUrl` is null, `uploadHeaders` is empty, and `directUpload` is false."
          }
        },
        "required": [
          "asset",
          "prepare"
        ],
        "additionalProperties": false
      },
      "ToolManifest": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1
          },
          "hash": {
            "type": "string",
            "description": "sha256 over the tool entries served to this key; also the response ETag. Equal hashes mean an identical list; a key without workflows (Actions) access is served a shorter list with its own hash."
          },
          "generatedAt": {
            "type": "string"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The tool name; also the path segment of `POST /v1/tools/{name}`."
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string",
                  "description": "Written for an agent: what the tool does, its limits, and what to call next."
                },
                "inputSchema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {},
                  "description": "JSON Schema (draft 2020-12) of the arguments the tool accepts; the request body must match it."
                },
                "outputSchema": {
                  "description": "JSON Schema (draft 2020-12) of the result body, when the tool declares one. Loose: it names the fields a caller can rely on (and project with `select`) without forbidding others.",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "annotations": {
                  "type": "object",
                  "properties": {
                    "readOnlyHint": {
                      "type": "boolean",
                      "description": "The tool reads and never changes the project."
                    },
                    "destructiveHint": {
                      "type": "boolean",
                      "description": "The tool may delete or replace what exists."
                    },
                    "openWorldHint": {
                      "type": "boolean",
                      "description": "The tool reaches outside Martini (for example, files a support case)."
                    },
                    "idempotentHint": {
                      "description": "Repeating the call with the same arguments has no further effect.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "readOnlyHint",
                    "destructiveHint",
                    "openWorldHint"
                  ],
                  "additionalProperties": false
                },
                "profiles": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "full",
                      "core"
                    ]
                  },
                  "description": "MCP profiles that serve the tool: `/mcp` serves `full`, `/mcp-core` serves `core`."
                },
                "requiresActions": {
                  "type": "boolean",
                  "description": "Only callers with workflows (Actions) access can see or invoke it; others get TOOL_NOT_FOUND."
                },
                "deprecated": {
                  "type": "object",
                  "properties": {
                    "sunsetDate": {
                      "description": "ISO-8601 date the tool stops being served, when scheduled.",
                      "type": "string"
                    },
                    "supersededBy": {
                      "description": "The tool to use instead, when there is a direct replacement.",
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": [
                "name",
                "description",
                "inputSchema",
                "annotations",
                "profiles",
                "requiresActions"
              ],
              "additionalProperties": false
            },
            "description": "Every tool this key can invoke, sorted by name."
          }
        },
        "required": [
          "version",
          "hash",
          "generatedAt",
          "tools"
        ],
        "additionalProperties": false
      },
      "Guide": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "const": 1
          },
          "transport": {
            "type": "string",
            "enum": [
              "mcp",
              "cli"
            ],
            "description": "The wording served: `cli` (commands and flags, plus the shell topic) or `mcp` (the MCP initialize text)."
          },
          "hash": {
            "type": "string",
            "description": "sha256 over `topics`; also the response ETag. It changes only when the text does, and differs per transport."
          },
          "generatedAt": {
            "type": "string"
          },
          "topics": {
            "type": "array",
            "description": "The rules by topic, in order; every line of every topic, newline-joined, is the whole text.",
            "items": {
              "$ref": "#/components/schemas/GuideTopic"
            }
          }
        },
        "required": [
          "version",
          "transport",
          "hash",
          "generatedAt",
          "topics"
        ],
        "additionalProperties": false
      },
      "GuideTopic": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable topic id: `orientation`, `generation`, `storage`, `support`, and `shell` (CLI wording only)."
          },
          "title": {
            "type": "string",
            "description": "A short heading for the topic."
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The rules in order, as plain text; a bullet starts with \"- \"."
          }
        },
        "required": [
          "id",
          "title",
          "lines"
        ],
        "additionalProperties": false
      },
      "CliLoginCreateRequest": {
        "type": "object",
        "properties": {
          "deviceLabel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "What the person will see when asked to approve: the machine name, and the host agent if any."
          },
          "purpose": {
            "description": "`login` (default): a 90-day `mtn_cli_…` key for the CLI itself. `app_key`: an organization `mtn_live_…` key for the app named by `appName`, approved by an admin of that organization, for the CLI to write into the app’s env file (`martini connect`).",
            "type": "string",
            "enum": [
              "login",
              "app_key"
            ]
          },
          "appName": {
            "description": "The app an `app_key` request is for: shown on the approval page and used as the key’s label.",
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "deviceLabel"
        ]
      },
      "CliLoginCreated": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The short code to type into the app, `ABCD-EFGH`. Never put it in a link."
          },
          "pollToken": {
            "type": "string",
            "description": "The secret that collects the key; poll `GET /v1/cli/login/{pollToken}` with it."
          },
          "verificationUrl": {
            "type": "string",
            "description": "Where the person confirms the code (the signed-in app)."
          },
          "expiresAt": {
            "type": "string"
          },
          "interval": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Seconds to wait between polls."
          }
        },
        "required": [
          "code",
          "pollToken",
          "verificationUrl",
          "expiresAt",
          "interval"
        ],
        "additionalProperties": false
      },
      "CliLoginPoll": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "pending"
              },
              "expiresAt": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "expiresAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "denied"
              }
            },
            "required": [
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "expired"
              }
            },
            "required": [
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "claimed"
              }
            },
            "required": [
              "status"
            ],
            "additionalProperties": false,
            "description": "The key was already collected by an earlier poll."
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "approved"
              },
              "key": {
                "type": "string",
                "description": "The minted key: `mtn_cli_…` for a login, `mtn_live_…` for an app key. Handed out exactly once; store it now."
              },
              "keyId": {
                "type": "string"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "organization",
                  "user"
                ],
                "description": "`organization`: bound to `organizationId`. `user`: an account key, approved \"as you\"."
              },
              "organizationId": {
                "description": "Null for an account key.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "expiresAt": {
                "description": "When a login key expires (90 days; run `martini login` again to renew). Null for an app key.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "purpose": {
                "type": "string",
                "enum": [
                  "login",
                  "app_key"
                ],
                "description": "What the request minted."
              },
              "label": {
                "type": "string",
                "description": "The key’s label: `CLI · <device>` for a login, the app’s name for an app key."
              },
              "projectId": {
                "description": "The organization’s API Generations project, the key’s default. Null for an account key.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "canvasId": {
                "description": "That project’s canvas. Null for an account key.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "status",
              "key",
              "keyId",
              "scope",
              "organizationId",
              "expiresAt",
              "purpose",
              "label",
              "projectId",
              "canvasId"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ToolError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Copy written for a human."
          },
          "code": {
            "type": "string",
            "description": "A fixed route code (TOOL_NOT_FOUND, INVALID_REQUEST, INVALID_ARGUMENTS, NOT_RAW_ELIGIBLE, TOOL_INVOCATION_FAILED, or a key error), or the tool’s own error code — for example ASSET_NOT_READY — with TOOL_ERROR when the tool gave none."
          },
          "tool": {
            "description": "The tool that answered, when the error came from invoking one.",
            "type": "string"
          },
          "required": {
            "description": "With API_KEY_PERMISSION_MISSING: the permission the operation requires.",
            "type": "string",
            "enum": [
              "generations:read",
              "generations:write",
              "workflows:read",
              "workflows:write",
              "assets:read",
              "assets:write",
              "billing:read",
              "billing:write"
            ]
          },
          "granted": {
            "description": "With API_KEY_PERMISSION_MISSING: the permissions the key holds.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "settingsUrl": {
            "description": "With API_KEY_PERMISSION_MISSING: where a key with the right permission is created.",
            "type": "string"
          }
        },
        "required": [
          "error",
          "code"
        ],
        "additionalProperties": false,
        "description": "Every non-2xx answer of POST /v1/tools/{name}. `code` is a fixed route code or the tool’s own MCP error code (open set); branch on it. API_KEY_PERMISSION_MISSING adds `required`, `granted`, and `settingsUrl`, as Error does."
      },
      "ToolResultBlocks": {
        "type": "object",
        "properties": {
          "blocks": {
            "type": "array",
            "description": "The content blocks, in the tool’s order.",
            "items": {
              "$ref": "#/components/schemas/ToolResultBlock"
            }
          }
        },
        "required": [
          "blocks"
        ],
        "additionalProperties": false,
        "description": "The answer of POST /v1/tools/{name}?format=blocks: the tool’s MCP content blocks in the order it wrote them. Nothing is unwrapped, merged, or re-ordered, and `structuredContent` is not added (its text copy is already a block), so a batch result keeps each text beside the image it describes. A tool error is answered as ToolError, not as blocks."
      },
      "ToolResultBlock": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "text"
              },
              "text": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "text"
            ],
            "additionalProperties": false,
            "description": "A text block, verbatim: the JSON a tool wrote (unparsed), a message such as one asset’s line in a batch, or a note the server appended."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image",
                  "audio"
                ]
              },
              "mimeType": {
                "type": "string"
              },
              "data": {
                "type": "string",
                "description": "The bytes, base64."
              }
            },
            "required": [
              "type",
              "mimeType",
              "data"
            ],
            "additionalProperties": false,
            "description": "An image or audio block with its bytes (`media=inline`, the default)."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image",
                  "audio"
                ]
              },
              "mimeType": {
                "type": "string"
              },
              "byteLength": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "The size of the bytes left out, decoded."
              }
            },
            "required": [
              "type",
              "mimeType",
              "byteLength"
            ],
            "additionalProperties": false,
            "description": "An image or audio block with `media=stub`: its decoded size in place of its bytes."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": {},
            "description": "Any other MCP content block (`resource`, `resource_link`, a type added later), passed through with every field the tool gave it."
          }
        ],
        "description": "One MCP content block of a tool result, as the tool wrote it."
      },
      "GenerationInput.alibaba.wan-3.0-prime.image-to-video": {
        "title": "alibaba/wan-3.0-prime/image-to-video",
        "description": "Model input for `alibaba/wan-3.0-prime/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "start_image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "start_image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.alibaba.wan-3.0-prime.reference-to-video": {
        "title": "alibaba/wan-3.0-prime/reference-to-video",
        "description": "Model input for `alibaba/wan-3.0-prime/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "aspect_ratio": {
            "default": "adaptive",
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "reference_image_urls": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_video_urls": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": false
      },
      "GenerationInput.alibaba.wan-3.0-prime.text-to-video": {
        "title": "alibaba/wan-3.0-prime/text-to-video",
        "description": "Model input for `alibaba/wan-3.0-prime/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.alibaba.wan-3.0.image-to-video": {
        "title": "alibaba/wan-3.0/image-to-video",
        "description": "Model input for `alibaba/wan-3.0/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "enable_prompt_expansion": {
            "default": true,
            "type": "boolean"
          },
          "enable_thinking": {
            "default": false,
            "type": "boolean"
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "start_image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "start_image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.alibaba.wan-3.0.reference-to-video": {
        "title": "alibaba/wan-3.0/reference-to-video",
        "description": "Model input for `alibaba/wan-3.0/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "enable_prompt_expansion": {
            "default": true,
            "type": "boolean"
          },
          "enable_thinking": {
            "default": false,
            "type": "boolean"
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "aspect_ratio": {
            "default": "adaptive",
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "reference_image_urls": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_video_urls": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": false
      },
      "GenerationInput.alibaba.wan-3.0.text-to-video": {
        "title": "alibaba/wan-3.0/text-to-video",
        "description": "Model input for `alibaba/wan-3.0/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000
          },
          "duration": {
            "default": 5,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "audio": {
            "default": true,
            "type": "boolean"
          },
          "enable_prompt_expansion": {
            "default": true,
            "type": "boolean"
          },
          "enable_thinking": {
            "default": false,
            "type": "boolean"
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.fast.image-to-video": {
        "title": "bytedance/seedance-2.0/fast/image-to-video",
        "description": "Model input for `bytedance/seedance-2.0/fast/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.fast.reference-to-video": {
        "title": "bytedance/seedance-2.0/fast/reference-to-video",
        "description": "Model input for `bytedance/seedance-2.0/fast/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.fast.text-to-video": {
        "title": "bytedance/seedance-2.0/fast/text-to-video",
        "description": "Model input for `bytedance/seedance-2.0/fast/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.image-to-video": {
        "title": "bytedance/seedance-2.0/image-to-video",
        "description": "Model input for `bytedance/seedance-2.0/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p",
              "4k"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.mini.image-to-video": {
        "title": "bytedance/seedance-2.0/mini/image-to-video",
        "description": "Model input for `bytedance/seedance-2.0/mini/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.mini.reference-to-video": {
        "title": "bytedance/seedance-2.0/mini/reference-to-video",
        "description": "Model input for `bytedance/seedance-2.0/mini/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.mini.text-to-video": {
        "title": "bytedance/seedance-2.0/mini/text-to-video",
        "description": "Model input for `bytedance/seedance-2.0/mini/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.reference-to-video": {
        "title": "bytedance/seedance-2.0/reference-to-video",
        "description": "Model input for `bytedance/seedance-2.0/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p",
              "4k"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.0.text-to-video": {
        "title": "bytedance/seedance-2.0/text-to-video",
        "description": "Model input for `bytedance/seedance-2.0/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p",
              "4k"
            ]
          },
          "duration": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 15
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "bitrate_mode": {
            "default": "standard",
            "type": "string",
            "enum": [
              "standard",
              "high"
            ]
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.5.image-to-video": {
        "title": "bytedance/seedance-2.5/image-to-video",
        "description": "Model input for `bytedance/seedance-2.5/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "draft": {
            "default": false,
            "type": "boolean"
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "duration": {
            "default": "auto",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "16",
                  "17",
                  "18",
                  "19",
                  "20",
                  "21",
                  "22",
                  "23",
                  "24",
                  "25",
                  "26",
                  "27",
                  "28",
                  "29",
                  "30",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 30
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.5.reference-to-video": {
        "title": "bytedance/seedance-2.5/reference-to-video",
        "description": "Model input for `bytedance/seedance-2.5/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "draft": {
            "default": false,
            "type": "boolean"
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "duration": {
            "default": "auto",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "16",
                  "17",
                  "18",
                  "19",
                  "20",
                  "21",
                  "22",
                  "23",
                  "24",
                  "25",
                  "26",
                  "27",
                  "28",
                  "29",
                  "30",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 30
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "image_urls": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "video_urls": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "audio_urls": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.bytedance.seedance-2.5.text-to-video": {
        "title": "bytedance/seedance-2.5/text-to-video",
        "description": "Model input for `bytedance/seedance-2.5/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "draft": {
            "default": false,
            "type": "boolean"
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "duration": {
            "default": "auto",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "10",
                  "11",
                  "12",
                  "13",
                  "14",
                  "15",
                  "16",
                  "17",
                  "18",
                  "19",
                  "20",
                  "21",
                  "22",
                  "23",
                  "24",
                  "25",
                  "26",
                  "27",
                  "28",
                  "29",
                  "30",
                  "auto"
                ]
              },
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 30
              }
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "generate_audio": {
            "default": true,
            "type": "boolean"
          },
          "end_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.creatify.boreal": {
        "title": "creatify/boreal",
        "description": "Model input for `creatify/boreal` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "audio_url": {
            "type": "string",
            "minLength": 1
          },
          "negative_prompt": {
            "type": "string"
          },
          "resolution": {
            "default": "1080p",
            "type": "string",
            "enum": [
              "720p",
              "1080p",
              "2k"
            ]
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4"
            ]
          },
          "duration": {
            "default": 10,
            "type": "number",
            "minimum": 1,
            "maximum": 20
          },
          "manifest_disclosure": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.fal-ai.minimax.hailuo-03.image-to-video": {
        "title": "fal-ai/minimax/hailuo-03/image-to-video",
        "description": "Model input for `fal-ai/minimax/hailuo-03/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "const": "2K"
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.fal-ai.minimax.hailuo-03.reference-to-video": {
        "title": "fal-ai/minimax/hailuo-03/reference-to-video",
        "description": "Model input for `fal-ai/minimax/hailuo-03/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "const": "2K"
          },
          "aspect_ratio": {
            "default": "adaptive",
            "type": "string",
            "enum": [
              "adaptive",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "reference_image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.fal-ai.minimax.hailuo-03.text-to-video": {
        "title": "fal-ai/minimax/hailuo-03/text-to-video",
        "description": "Model input for `fal-ai/minimax/hailuo-03/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "const": "2K"
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.fal-ai.nano-banana-2": {
        "title": "fal-ai/nano-banana-2",
        "description": "Model input for `fal-ai/nano-banana-2` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "num_images": {
            "default": 1,
            "type": "number",
            "const": 1
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "3:2",
              "4:3",
              "5:4",
              "1:1",
              "4:5",
              "3:4",
              "2:3",
              "9:16",
              "4:1",
              "1:4",
              "8:1",
              "1:8"
            ]
          },
          "output_format": {
            "default": "png",
            "type": "string",
            "enum": [
              "jpeg",
              "png",
              "webp"
            ]
          },
          "safety_tolerance": {
            "default": "6",
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4",
              "5",
              "6"
            ]
          },
          "sync_mode": {
            "default": false,
            "type": "boolean",
            "const": false
          },
          "system_prompt": {
            "type": "string",
            "maxLength": 40000
          },
          "resolution": {
            "default": "1K",
            "type": "string",
            "enum": [
              "0.5K",
              "1K",
              "2K",
              "4K"
            ]
          },
          "limit_generations": {
            "default": true,
            "type": "boolean"
          },
          "enable_web_search": {
            "type": "boolean"
          },
          "thinking_level": {
            "type": "string",
            "enum": [
              "minimal",
              "high"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.fal-ai.nano-banana-2.edit": {
        "title": "fal-ai/nano-banana-2/edit",
        "description": "Model input for `fal-ai/nano-banana-2/edit` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "num_images": {
            "default": 1,
            "type": "number",
            "const": 1
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "aspect_ratio": {
            "default": "auto",
            "type": "string",
            "enum": [
              "auto",
              "21:9",
              "16:9",
              "3:2",
              "4:3",
              "5:4",
              "1:1",
              "4:5",
              "3:4",
              "2:3",
              "9:16",
              "4:1",
              "1:4",
              "8:1",
              "1:8"
            ]
          },
          "output_format": {
            "default": "png",
            "type": "string",
            "enum": [
              "jpeg",
              "png",
              "webp"
            ]
          },
          "safety_tolerance": {
            "default": "6",
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4",
              "5",
              "6"
            ]
          },
          "sync_mode": {
            "default": false,
            "type": "boolean",
            "const": false
          },
          "system_prompt": {
            "type": "string",
            "maxLength": 40000
          },
          "resolution": {
            "default": "1K",
            "type": "string",
            "enum": [
              "0.5K",
              "1K",
              "2K",
              "4K"
            ]
          },
          "limit_generations": {
            "default": true,
            "type": "boolean"
          },
          "enable_web_search": {
            "type": "boolean"
          },
          "thinking_level": {
            "type": "string",
            "enum": [
              "minimal",
              "high"
            ]
          },
          "image_urls": {
            "minItems": 1,
            "maxItems": 14,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt",
          "image_urls"
        ],
        "additionalProperties": false
      },
      "GenerationInput.martini.seedance-2.5-custom-draft-enhance": {
        "title": "martini/seedance-2.5-custom-draft-enhance",
        "description": "Model input for `martini/seedance-2.5-custom-draft-enhance` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "source_asset_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "source_asset_id"
        ],
        "additionalProperties": false
      },
      "GenerationInput.martini.seedance-2.5-custom-edit-draft-enhance": {
        "title": "martini/seedance-2.5-custom-edit-draft-enhance",
        "description": "Model input for `martini/seedance-2.5-custom-edit-draft-enhance` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "source_asset_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "source_asset_id"
        ],
        "additionalProperties": false
      },
      "GenerationInput.martini.seedance-2.5-draft-enhance": {
        "title": "martini/seedance-2.5-draft-enhance",
        "description": "Model input for `martini/seedance-2.5-draft-enhance` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "source_asset_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "source_asset_id"
        ],
        "additionalProperties": false
      },
      "GenerationInput.martini.seedance-2.5-edit-draft-enhance": {
        "title": "martini/seedance-2.5-edit-draft-enhance",
        "description": "Model input for `martini/seedance-2.5-edit-draft-enhance` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "source_asset_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "source_asset_id"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3-max-turbo.image-to-video": {
        "title": "minimax/h3-max-turbo/image-to-video",
        "description": "Model input for `minimax/h3-max-turbo/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "prompt_expansion_mode": {
            "default": "balanced",
            "type": "string",
            "enum": [
              "disabled",
              "balanced"
            ]
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "768P",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "1080P"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3-max-turbo.text-to-video": {
        "title": "minimax/h3-max-turbo/text-to-video",
        "description": "Model input for `minimax/h3-max-turbo/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "prompt_expansion_mode": {
            "default": "balanced",
            "type": "string",
            "enum": [
              "disabled",
              "balanced"
            ]
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "768P",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "1080P"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3-max.image-to-video": {
        "title": "minimax/h3-max/image-to-video",
        "description": "Model input for `minimax/h3-max/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "prompt_expansion_mode": {
            "default": "balanced",
            "type": "string",
            "enum": [
              "disabled",
              "balanced"
            ]
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "768P",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "1080P"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          },
          "target_audio_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3-max.reference-to-video": {
        "title": "minimax/h3-max/reference-to-video",
        "description": "Model input for `minimax/h3-max/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "prompt_expansion_mode": {
            "default": "balanced",
            "type": "string",
            "enum": [
              "disabled",
              "balanced"
            ]
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "768P",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "1080P"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "aspect_ratio": {
            "default": "adaptive",
            "type": "string",
            "enum": [
              "adaptive",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "reference_image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          },
          "middle_image_url": {
            "type": "string",
            "minLength": 1
          },
          "middle_frame_time": {
            "type": "number",
            "exclusiveMinimum": 0,
            "exclusiveMaximum": 15
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3-max.text-to-video": {
        "title": "minimax/h3-max/text-to-video",
        "description": "Model input for `minimax/h3-max/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40000
          },
          "prompt_expansion_mode": {
            "default": "balanced",
            "type": "string",
            "enum": [
              "disabled",
              "balanced"
            ]
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "768P",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "1080P"
            ]
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enable_safety_checker": {
            "default": true,
            "type": "boolean"
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3.image-to-video": {
        "title": "minimax/h3/image-to-video",
        "description": "Model input for `minimax/h3/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "2K",
              "4K"
            ]
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "end_image_url": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3.reference-to-video": {
        "title": "minimax/h3/reference-to-video",
        "description": "Model input for `minimax/h3/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "2K",
              "4K"
            ]
          },
          "aspect_ratio": {
            "default": "adaptive",
            "type": "string",
            "enum": [
              "adaptive",
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "reference_image_urls": {
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_video_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.minimax.h3.text-to-video": {
        "title": "minimax/h3/text-to-video",
        "description": "Model input for `minimax/h3/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50000
          },
          "duration": {
            "default": 5,
            "type": "integer",
            "minimum": 5,
            "maximum": 15
          },
          "resolution": {
            "default": "2K",
            "type": "string",
            "enum": [
              "480P",
              "768P",
              "2K",
              "4K"
            ]
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "21:9",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      },
      "GenerationInput.xai.grok-imagine-video.v1.5.image-to-video": {
        "title": "xai/grok-imagine-video/v1.5/image-to-video",
        "description": "Model input for `xai/grok-imagine-video/v1.5/image-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "duration": {
            "default": 6,
            "type": "integer",
            "minimum": 1,
            "maximum": 15
          },
          "image_url": {
            "type": "string",
            "minLength": 1
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          }
        },
        "required": [
          "prompt",
          "image_url"
        ],
        "additionalProperties": false
      },
      "GenerationInput.xai.grok-imagine-video.v1.5.reference-to-video": {
        "title": "xai/grok-imagine-video/v1.5/reference-to-video",
        "description": "Model input for `xai/grok-imagine-video/v1.5/reference-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "reference_image_urls": {
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "reference_audio_urls": {
            "maxItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "duration": {
            "default": 8,
            "type": "integer",
            "minimum": 1,
            "maximum": 15
          },
          "resolution": {
            "default": "480p",
            "type": "string",
            "enum": [
              "480p",
              "720p"
            ]
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "16:9",
              "4:3",
              "3:2",
              "1:1",
              "2:3",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt",
          "reference_image_urls"
        ],
        "additionalProperties": false
      },
      "GenerationInput.xai.grok-imagine-video.v1.5.text-to-video": {
        "title": "xai/grok-imagine-video/v1.5/text-to-video",
        "description": "Model input for `xai/grok-imagine-video/v1.5/text-to-video` (fal field names). Media URL fields accept public HTTPS URLs, Martini URLs, and `data:` URLs.",
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "duration": {
            "default": 6,
            "type": "integer",
            "minimum": 1,
            "maximum": 15
          },
          "resolution": {
            "default": "720p",
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p"
            ]
          },
          "aspect_ratio": {
            "default": "16:9",
            "type": "string",
            "enum": [
              "16:9",
              "4:3",
              "3:2",
              "1:1",
              "2:3",
              "3:4",
              "9:16"
            ]
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": false
      }
    }
  }
}
