{
  "openapi": "3.1.0",
  "info": {
    "title": "Kentucky AI API",
    "version": "1.0.0",
    "description": "Kentucky AI labels, trains and hosts models for construction drawings, and everything runs over this API. One API key calls everything in your company's My models: your own drawing models, the ready-made ones your company added, and language models.\n\n* **Drawing models**: send a sheet (PNG/JPEG, one PDF page, or a sheet already in Kentucky AI) to\n  `POST /models/{slug}/predict`, or in the background with `/jobs` and `/batches`, and get every item back with a box and an outline.\n* **Language models**: `POST /chat/completions` (OpenAI-compatible) and `POST /messages` (Anthropic-compatible), so the OpenAI\n  and Anthropic SDKs work by changing their base URL. Billed per token.\n\n**Authentication.** `Authorization: Bearer ka_...` with your API key (make it on the API keys page; it is shown once). The scheme word is not case-sensitive. `/messages` also takes `x-api-key: ka_...`, as the Anthropic SDK sends it. **Call this API from your server and keep the key in its settings; never put it in a browser page or a mobile app.**\n\n**Errors.** Drawing-model endpoints answer `{\"error\": {\"code\", \"message\"}}`; `/chat/completions` and `/models` answer in the OpenAI form, `/messages` in the Anthropic form. Branch on the code, never on the message. Every 429 carries `Retry-After`, and so does a 503 from a busy platform.\n\n**Error codes by status.** 400 `bad_request`, `invalid_request`, `not_a_language_model`, `stream_not_supported`, `tools_not_supported`, `vision_not_supported`, `context_length_exceeded`, `content_policy_violation`, `invalid_fallbacks` · 401 `unauthorized`, `invalid_api_key` · 402 `page_not_indexed`, `payment_required`, `spend_limit`, `team_spend_limit` · 403 `read_only`, `not_admin`, `unauthorized`, `not_added`, `origin_blocked` · 404 `not_found`, `model_not_found` · 405 `method_not_allowed` · 409 `idempotency_in_progress`, `wrong_offset`, `result_not_ready`, `paused` · 410 `job_expired`, `model_retired` · 413 `too_large` · 422 `idempotency_key_reused`, `sha256_mismatch` · 429 `rate_limited`, `concurrency_limit`, `quota_exceeded`, `team_quota_exceeded`, `provider_rate_limited` · 500 `inference_failed` · 502 `provider_error`, `provider_unavailable` · 503 `unavailable`, `overloaded`, `inference_timeout`, `provider_unavailable` · 504 `provider_timeout`. The Errors guide says what each means and what to do.\n\n**This document.** Generated from the API's code and served at `GET /api/ka/v1/openapi.json` (no key needed). Guides, SDKs and a Markdown version for AI coding tools are at `/docs/` and `/llms.txt`.",
    "contact": {
      "name": "Kentucky AI"
    },
    "summary": "Drawing models and language models for construction drawings, over one API key."
  },
  "servers": [
    {
      "url": "https://{host}/api/ka/v1",
      "description": "Your Kentucky AI address.",
      "variables": {
        "host": {
          "default": "your-kentucky-ai-host",
          "description": "The host you sign in to."
        }
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Model",
      "description": "What a model accepts and finds."
    },
    {
      "name": "Predict",
      "description": "One sheet in, items out, in one call."
    },
    {
      "name": "Jobs",
      "description": "One sheet in the background: answer at once with a job, poll it or get a webhook."
    },
    {
      "name": "Batches",
      "description": "Many sheets for one model, in the background, fair-queued at batch priority."
    },
    {
      "name": "Language models",
      "x-displayName": "Chat, messages, models",
      "description": "The language models in your My models, OpenAI- and Anthropic-compatible, billed per token. Model ids are the slugs on Explore models › LLMs."
    },
    {
      "name": "Plan Indexer",
      "description": "Read drawing sets and spec books into a structured index (sheets, schedules, legends, the project record, spec sections and clauses, a search corpus), billed per page."
    },
    {
      "name": "Cloud Backup",
      "description": "Back up the OpenTakeoff app's \"Download everything\" zip: a resumable upload, the list and the download (owner and admins). $4 a month with 50 GB included."
    },
    {
      "name": "Mail ingestion",
      "description": "Bill the email messages the OpenTakeoff app processed on your computer, once per message, priced per message."
    },
    {
      "name": "Tools",
      "description": "The catalogue of tools your company can call (one per model in My models, plus the built-in ones), generated from the platform, for MCP servers and agents; and your usage."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Drawing models",
      "tags": [
        "Model",
        "Predict",
        "Jobs",
        "Batches"
      ]
    },
    {
      "name": "Language models",
      "tags": [
        "Language models"
      ]
    },
    {
      "name": "Extensions",
      "tags": [
        "Plan Indexer",
        "Mail ingestion",
        "Cloud Backup"
      ]
    },
    {
      "name": "Tools and usage",
      "tags": [
        "Tools"
      ]
    }
  ],
  "paths": {
    "/models/{slug}": {
      "get": {
        "operationId": "getModel",
        "description": "What a caller needs before sending anything: the item types (`classes`), what each item's `polygon` is (`output.shape`), the accepted input formats and sizes, the sheet size the model expects, and which versions can be pinned. Works on a paused model of your own too (`status: \"paused\"`). Takes `?version=N` like predict. One address form serves everything in your My models: your own models and the ready-made (Kentucky AI or marketplace) models your company added; the same API key calls all of them. A ready-made model your company has not added answers 403 `not_added`, one no longer offered 410 `model_retired`, one that cannot run right now 503 `unavailable`. `/deployments/{slug}/...` addresses from before keep working as aliases of these. For a ready-made model the answer is `HostedModelInfo` (what it finds, its price per call and your rate limit on it); for a language model, `LanguageModelInfo` (your prices per 1M tokens, the long-prompt tier, context window and abilities).",
        "summary": "Model info",
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "description": "The model's address name (slug), as shown on its page in My models: one of your own models or a ready-made model your company added.",
            "required": true
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Pin a model version number instead of the active one. Only ready versions of the deployment's own model can be pinned; anything else is a 400 that lists the versions you can use. A pinned and an unpinned call with the same Idempotency-Key are different requests."
          }
        ],
        "tags": [
          "Model"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/DeploymentInfo"
                    },
                    {
                      "$ref": "#/components/schemas/HostedModelInfo"
                    },
                    {
                      "$ref": "#/components/schemas/LanguageModelInfo"
                    }
                  ]
                },
                "examples": {
                  "OutlineModel": {
                    "value": {
                      "name": "d",
                      "slug": "dep-a",
                      "status": "active",
                      "task": "instance_segmentation",
                      "model_version_number": 1,
                      "active_version_number": 1,
                      "available_versions": [
                        1,
                        2
                      ],
                      "classes": [
                        "door",
                        "window"
                      ],
                      "output": {
                        "shape": "outline",
                        "description": "Each item has an outline that follows its shape, traced from the model's mask (\"polygon\")."
                      },
                      "confidence_threshold": 0.5,
                      "input": {
                        "formats": [
                          "png",
                          "jpeg",
                          "pdf"
                        ],
                        "max_bytes": 31457280,
                        "max_pixels": 60000000,
                        "sheet_longest_side_px": 2400,
                        "max_longest_side_px": 4096,
                        "training_scale": 0.5,
                        "pdf_render_dpi": "72 x max(1, 2400 / longest page side in points), at most 4096 px",
                        "image_scaling": "an image is used as sent (scans and photos are trained at their own pixels); for a render of a PDF page send the PDF itself, or \"auto_scale\": true to resize the image to the size its page would be as a PDF, from its dpi (none = 72)"
                      },
                      "endpoints": {
                        "predict": "/api/ka/v1/models/dep-a/predict",
                        "jobs": "/api/ka/v1/models/dep-a/jobs",
                        "openapi": "/api/ka/v1/openapi.json"
                      },
                      "pin_a_version": "add ?version=<number> to predict, jobs or this call; without it the active version answers",
                      "confidence_threshold_source": "default",
                      "confidence_threshold_note": "No cut-off is set and the model has no tested cut-off, so the default (0.5) applies: items below it are dropped."
                    },
                    "summary": "Outline model"
                  },
                  "BoxModel": {
                    "value": {
                      "name": "d",
                      "slug": "dep-a",
                      "status": "active",
                      "task": "instance_segmentation",
                      "model_version_number": 1,
                      "active_version_number": 1,
                      "available_versions": [
                        1,
                        2
                      ],
                      "classes": [
                        "door",
                        "window"
                      ],
                      "output": {
                        "shape": "box",
                        "description": "Each item is a box. \"polygon\" is that box's four corners and is the same as \"bbox\". This model does not draw outlines."
                      },
                      "confidence_threshold": 0.5,
                      "input": {
                        "formats": [
                          "png",
                          "jpeg",
                          "pdf"
                        ],
                        "max_bytes": 31457280,
                        "max_pixels": 60000000,
                        "sheet_longest_side_px": 2400,
                        "max_longest_side_px": 4096,
                        "training_scale": 0.5,
                        "pdf_render_dpi": "72 x max(1, 2400 / longest page side in points), at most 4096 px",
                        "image_scaling": "an image is used as sent (scans and photos are trained at their own pixels); for a render of a PDF page send the PDF itself, or \"auto_scale\": true to resize the image to the size its page would be as a PDF, from its dpi (none = 72)"
                      },
                      "endpoints": {
                        "predict": "/api/ka/v1/models/dep-a/predict",
                        "jobs": "/api/ka/v1/models/dep-a/jobs",
                        "openapi": "/api/ka/v1/openapi.json"
                      },
                      "pin_a_version": "add ?version=<number> to predict, jobs or this call; without it the active version answers",
                      "confidence_threshold_source": "default",
                      "confidence_threshold_note": "No cut-off is set and the model has no tested cut-off, so the default (0.5) applies: items below it are dropped."
                    },
                    "summary": "Box model"
                  },
                  "PinnedToVersion2": {
                    "value": {
                      "name": "d",
                      "slug": "dep-a",
                      "status": "active",
                      "task": "instance_segmentation",
                      "model_version_number": 2,
                      "active_version_number": 1,
                      "available_versions": [
                        1,
                        2
                      ],
                      "classes": [
                        "door",
                        "window"
                      ],
                      "output": {
                        "shape": "outline",
                        "description": "Each item has an outline that follows its shape, traced from the model's mask (\"polygon\")."
                      },
                      "confidence_threshold": 0.5,
                      "input": {
                        "formats": [
                          "png",
                          "jpeg",
                          "pdf"
                        ],
                        "max_bytes": 31457280,
                        "max_pixels": 60000000,
                        "sheet_longest_side_px": 2400,
                        "max_longest_side_px": 4096,
                        "training_scale": 0.5,
                        "pdf_render_dpi": "72 x max(1, 2400 / longest page side in points), at most 4096 px",
                        "image_scaling": "an image is used as sent (scans and photos are trained at their own pixels); for a render of a PDF page send the PDF itself, or \"auto_scale\": true to resize the image to the size its page would be as a PDF, from its dpi (none = 72)"
                      },
                      "endpoints": {
                        "predict": "/api/ka/v1/models/dep-a/predict",
                        "jobs": "/api/ka/v1/models/dep-a/jobs",
                        "openapi": "/api/ka/v1/openapi.json"
                      },
                      "pin_a_version": "add ?version=<number> to predict, jobs or this call; without it the active version answers",
                      "confidence_threshold_source": "default",
                      "confidence_threshold_note": "No cut-off is set and the model has no tested cut-off, so the default (0.5) applies: items below it are dropped."
                    },
                    "summary": "Pinned to version 2"
                  },
                  "PausedDeployment": {
                    "value": {
                      "name": "d",
                      "slug": "dep-a",
                      "status": "paused",
                      "task": "instance_segmentation",
                      "model_version_number": 1,
                      "active_version_number": 1,
                      "available_versions": [
                        1,
                        2
                      ],
                      "classes": [
                        "door",
                        "window"
                      ],
                      "output": {
                        "shape": "outline",
                        "description": "Each item has an outline that follows its shape, traced from the model's mask (\"polygon\")."
                      },
                      "confidence_threshold": 0.5,
                      "input": {
                        "formats": [
                          "png",
                          "jpeg",
                          "pdf"
                        ],
                        "max_bytes": 31457280,
                        "max_pixels": 60000000,
                        "sheet_longest_side_px": 2400,
                        "max_longest_side_px": 4096,
                        "training_scale": 0.5,
                        "pdf_render_dpi": "72 x max(1, 2400 / longest page side in points), at most 4096 px",
                        "image_scaling": "an image is used as sent (scans and photos are trained at their own pixels); for a render of a PDF page send the PDF itself, or \"auto_scale\": true to resize the image to the size its page would be as a PDF, from its dpi (none = 72)"
                      },
                      "endpoints": {
                        "predict": "/api/ka/v1/models/dep-a/predict",
                        "jobs": "/api/ka/v1/models/dep-a/jobs",
                        "openapi": "/api/ka/v1/openapi.json"
                      },
                      "pin_a_version": "add ?version=<number> to predict, jobs or this call; without it the active version answers",
                      "confidence_threshold_source": "default",
                      "confidence_threshold_note": "No cut-off is set and the model has no tested cut-off, so the default (0.5) applies: items below it are dropped."
                    },
                    "summary": "Paused deployment"
                  }
                }
              }
            },
            "description": "The model: your own (`DeploymentInfo`), a ready-made one (`HostedModelInfo`) or a language model (`LanguageModelInfo`)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "UnknownVersion": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "version 9 does not exist for this deployment (available: 1, 2)"
                      }
                    },
                    "summary": "unknown version"
                  }
                }
              }
            },
            "description": "`?version=` is not a whole number, or not a version you can pin. The message lists the versions you can use."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NoKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "no key"
                  }
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Turned-offOrUnknownKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page."
                      }
                    },
                    "summary": "turned-off or unknown key"
                  }
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "UnknownDeployment": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "deployment not found"
                      }
                    },
                    "summary": "unknown deployment"
                  }
                }
              }
            },
            "description": "No such deployment, or one your key cannot use (another organization's, or outside the key's deployment list). These look the same on purpose."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ModelRetired": {
                    "value": {
                      "error": {
                        "code": "model_retired",
                        "message": "This model is no longer offered. Remove it from My models, or pick another one on Explore models."
                      }
                    },
                    "summary": "model_retired"
                  }
                }
              }
            },
            "description": "The model was offered but is not any more."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unavailable": {
                    "value": {
                      "error": {
                        "code": "unavailable",
                        "message": "This model is not available right now. Try again later."
                      }
                    },
                    "summary": "unavailable"
                  }
                }
              }
            },
            "description": "The model is offered but cannot answer right now."
          }
        }
      }
    },
    "/models/{slug}/predict": {
      "post": {
        "operationId": "predict",
        "description": "Runs the deployment's model on one sheet and answers when it is done. A big sheet can take minutes, more when the model has to load first, so set a client timeout of 300 seconds, or use `POST .../jobs` to not wait.\n\n**Input.** Send exactly one of `image` (PNG or JPEG, base64), `pdf` (base64; one page per call, `page` counts from 1 and defaults to 1) or `sheet_id` (a sheet already in Kentucky AI); sending none or more than one is a 400 \"send exactly one of image, pdf, sheet_id\". Base64 may be wrapped over several lines and may start with a `data:image/png;base64,` prefix. A corrupt or truncated image is a 400 (\"image could not be read (corrupt or truncated)\"), never a 500. Types are strict: `sheet_id` is an integer and `score_threshold` a number (not strings, not true/false). Up to 30 MB and 60 megapixels. A PDF page is drawn the way Kentucky AI draws its own sheets (1 px per point; pages under 2400 pt long are enlarged to 2400 px, never beyond 4096 px), which is what the model was trained on. An image is used exactly as sent; if it is a render of a PDF page, send the PDF instead, or add `\"auto_scale\": true` to resize it to the size its page would be as a PDF (from its dpi; none counts as 72). The answer then says so in `image_scale_applied`. Coordinates always stay in the pixels of the image you sent.\n\n**Output.** `counts` per class (every item type this model was trained to find, 0 when none were found; a type that was only on validation or test sheets is not trained and not listed) and every item with `label`, `confidence` (0-1), `bbox` (`[left, top, width, height]` in image pixels from the top-left) and `polygon`. Only items at or above the cut-off are returned. The cut-off is `score_threshold` if you send it, else the deployment's confidence setting, else the one the model was tested at; with none of these an instance model uses 0.5 and a semantic model returns every item (the model info says which applies). **Check `shape` before using `polygon`:** `box` means the model finds boxes only and `polygon` is the box's four corners (identical to `bbox`); `outline` means `polygon` follows the item. For a PDF the answer also carries `polygon_source` per item, in PDF points from the top-left of the page as displayed (`source_units: \"pt\"`), and `pdf` with `px_per_pt` and `page_size_pt`. The request's `page` counts from 1, but `page` on each item counts from 0 (0 is the first page). With `sheet_id`, `polygon_source` is in the drawing's own units.\n\n**Version.** Runs on the deployment's active version. `?version=N` runs version N instead (it must be ready and cleared for commercial use, otherwise 400 listing the versions you can use); `model_version_number` in the answer says which one ran.\n\n**Retries.** Send an `Idempotency-Key`: a repeat of the same key and body is answered from the first call (`usage.duplicate_request: true`), is billed once, runs nothing and does not count against your rate limit. The same key with a different body is a 422.\n\n**Limits.** Every answer from this point on carries `X-RateLimit-Limit` / `X-RateLimit-Remaining` (the tighter of the key's own per-deployment limit and the deployment's limit), including 400, 402, 409, 422 and 500, and a replay of an Idempotency-Key (which shows the current state without using a call). The checks run in this order: key and deployment (401, 403, 404, 409), version (400), a repeated Idempotency-Key (answered here), rate limit (429), spending limit (402), then the input (400).\n\n**Ready-made models.** One address form serves everything in your My models: your own models and the ready-made (Kentucky AI or marketplace) models your company added; the same API key calls all of them. A ready-made model your company has not added answers 403 `not_added`, one no longer offered 410 `model_retired`, one that cannot run right now 503 `unavailable`. `/deployments/{slug}/...` addresses from before keep working as aliases of these. Each answered call to a ready-made model is billed to your company at its price per call (an `Idempotency-Key` replay is answered from the first call and billed once); its rate limit is per company on that model (and the key's own limit, when it has one). `sheet_id` must be one of your own sheets.\n\n**Fallbacks.** On My models a company owner or admin can give each model up to 2 fallbacks of the same job, tried in order when this model cannot answer for a reason that is not yours: it did not answer in time (`inference_timeout`), failed (`inference_failed`), or was paused, retired or made unavailable after you added it. Nothing else switches models: a bad input (400), your spending limit (402), your rate limits or quotas (429) are answered as they are. A call can send its own list in `fallbacks` (slugs in your My models that this key can call, doing the same job); it replaces the saved one for this call, and `[]` means none. The answer from a fallback has `model` set to the fallback's slug, `usage.fallback` saying which model was asked for and why it did not answer, and the header `X-KA-Fallback-From`. It is billed once, at the price per sheet of the model that answered (never below the minimum per sheet). Before the call, the spending limit must fit the dearest model that could answer. A fallback that finds fewer item types answers with its own `counts`.",
        "summary": "Predict (wait for the answer)",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            },
            "description": "Any string you choose, unique per request (a sheet name works). A retry with the same key and body returns the first answer and is billed once; the same key with a different body is a 422. Kept 24 hours (per web process unless a shared cache is configured; billing is never doubled)."
          },
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "description": "The model's address name (slug), as shown on its page in My models: one of your own models or a ready-made model your company added.",
            "required": true
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Pin a model version number instead of the active one. Only ready versions of the deployment's own model can be pinned; anything else is a 400 that lists the versions you can use. A pinned and an unpinned call with the same Idempotency-Key are different requests."
          }
        ],
        "tags": [
          "Predict"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PredictRequest"
              },
              "examples": {
                "Image": {
                  "value": {
                    "image": "iVBORw0KGgoAAAANSUhEUgAAAlgAAAGQCAIAAAD9V4nPAAAF+UlEQVR4nO3VMQEAIAzAMMC/5yFjRxMF/Xpn5gBA1dsOAIBNRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkPYBFhIGHZ9D6k8AAAAASUVORK5CYII=",
                    "score_threshold": 0.5
                  },
                  "summary": "Image"
                },
                "PDFPage2": {
                  "value": {
                    "pdf": "JVBERi0xLjcNCiWhs8XXDQoxIDAgb2JqDQo8PC9QYWdlcyAyIDAgUiAvVHlwZS9DYXRhbG9nPj4NCmVuZG9iag0KMiAwIG9iag0KPDwvQ291bnQgMi9LaWRzWyA0IDAgUiAgNSAwIFIgXS9UeXBlL1BhZ2VzPj4NCmVuZG9iag0KMyAwIG9iag0KPDwvQ3JlYXRpb25EYXRlKEQ6MjAyNjExMTYxMTM3NDIrMDAnMDAnKS9DcmVhdG9yKFBERml1bSk+Pg0KZW5kb2JqDQo0IDAgb2JqDQo8PC9NZWRpYUJveFsgMCAwIDYxMiA3OTJdL1BhcmVudCAyIDAgUiAvUmVzb3VyY2VzPDw+Pi9Sb3RhdGUgMC9UeXBlL1BhZ2U+Pg0KZW5kb2JqDQo1IDAgb2JqDQo8PC9NZWRpYUJveFsgMCAwIDg0MiA1OTVdL1BhcmVudCAyIDAgUiAvUmVzb3VyY2VzPDw+Pi9Sb3RhdGUgMC9UeXBlL1BhZ2U+Pg0KZW5kb2JqDQp4cmVmDQowIDYNCjAwMDAwMDAwMDAgNjU1MzUgZg0KMDAwMDAwMDAxNyAwMDAwMCBuDQowMDAwMDAwMDY2IDAwMDAwIG4NCjAwMDAwMDAxMjkgMDAwMDAgbg0KMDAwMDAwMDIwNiAwMDAwMCBuDQowMDAwMDAwMjk5IDAwMDAwIG4NCnRyYWlsZXINCjw8DQovUm9vdCAxIDAgUg0KL0luZm8gMyAwIFINCi9TaXplIDYvSURbPDQ2RERGQjQ5MUZENzE5QjUyQzY3MzYxNUJGREFCNzA5Pjw0NkRERkI0OTFGRDcxOUI1MkM2NzM2MTVCRkRBQjcwOT5dPj4NCnN0YXJ0eHJlZg0KMzkyDQolJUVPRg0K",
                    "page": 2
                  },
                  "summary": "PDF page 2"
                },
                "SheetAlreadyInKentuckyAI": {
                  "value": {
                    "sheet_id": 1
                  },
                  "summary": "Sheet already in Kentucky AI"
                },
                "ImageWithAutoScale": {
                  "value": {
                    "image": "iVBORw0KGgoAAAANSUhEUgAABMgAAAMYCAIAAACxNUz5AAAACXBIWXMAAAsTAAALEwEAmpwYAAARh0lEQVR4nO3XwQ3AIBDAsNL9dz52IA+EZE+Qb9bMfAAAAHDqvx0AAADA24wlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAABJjCQAAQGIsAQAASIwlAAAAibEEAAAgMZYAAAAkxhIAAIDEWAIAAJAYSwAAAJINaKIJLZn2KLAAAAAASUVORK5CYII=",
                    "auto_scale": true
                  },
                  "summary": "Image with auto_scale"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "X-KA-Fallback-From": {
                "schema": {
                  "type": "string"
                },
                "description": "Present when a fallback answered: the slug of the model you called, which could not answer. `model` names the one that did."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PredictResult"
                },
                "examples": {
                  "Image,OutlineModel": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        600,
                        400
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              360.0,
                              200.0
                            ],
                            [
                              396.0,
                              200.0
                            ],
                            [
                              396.0,
                              224.0
                            ],
                            [
                              432.0,
                              224.0
                            ],
                            [
                              432.0,
                              248.0
                            ],
                            [
                              360.0,
                              248.0
                            ]
                          ],
                          "bbox": [
                            360.0,
                            200.0,
                            72.0,
                            48.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 4.3,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "Image, outline model"
                  },
                  "PDFPage2(polygonSourceInPoints)": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        2400,
                        1696
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              600.0,
                              424.0
                            ],
                            [
                              840.0,
                              424.0
                            ],
                            [
                              840.0,
                              508.8
                            ],
                            [
                              600.0,
                              508.8
                            ]
                          ],
                          "bbox": [
                            600.0,
                            424.0,
                            240.0,
                            84.8
                          ],
                          "page": 1,
                          "shape": "outline",
                          "polygon_source": [
                            [
                              210.5,
                              148.7533
                            ],
                            [
                              294.7,
                              148.7533
                            ],
                            [
                              294.7,
                              178.504
                            ],
                            [
                              210.5,
                              178.504
                            ]
                          ],
                          "source_units": "pt"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              1440.0,
                              848.0
                            ],
                            [
                              1584.0,
                              848.0
                            ],
                            [
                              1584.0,
                              949.76
                            ],
                            [
                              1728.0,
                              949.76
                            ],
                            [
                              1728.0,
                              1051.52
                            ],
                            [
                              1440.0,
                              1051.52
                            ]
                          ],
                          "bbox": [
                            1440.0,
                            848.0,
                            288.0,
                            203.52
                          ],
                          "page": 1,
                          "shape": "outline",
                          "polygon_source": [
                            [
                              505.2,
                              297.5067
                            ],
                            [
                              555.72,
                              297.5067
                            ],
                            [
                              555.72,
                              333.2075
                            ],
                            [
                              606.24,
                              333.2075
                            ],
                            [
                              606.24,
                              368.9083
                            ],
                            [
                              505.2,
                              368.9083
                            ]
                          ],
                          "source_units": "pt"
                        }
                      ],
                      "pdf": {
                        "px_per_pt": 2.8503562945368173,
                        "page_size_pt": [
                          842.0,
                          595.0
                        ]
                      },
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 79.5,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "PDF page 2 (polygon_source in points)"
                  },
                  "SheetAlreadyInKentuckyAI": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        2400,
                        1855
                      ],
                      "sheet_id": 1,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              600.0,
                              463.5
                            ],
                            [
                              840.0,
                              463.5
                            ],
                            [
                              840.0,
                              556.2
                            ],
                            [
                              600.0,
                              556.2
                            ]
                          ],
                          "bbox": [
                            600.0,
                            463.5,
                            240.0,
                            92.7
                          ],
                          "page": 0,
                          "shape": "outline",
                          "polygon_source": [
                            [
                              198.0,
                              152.955
                            ],
                            [
                              277.2,
                              152.955
                            ],
                            [
                              277.2,
                              183.546
                            ],
                            [
                              198.0,
                              183.546
                            ]
                          ],
                          "source_units": "pt"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              1440.0,
                              927.0
                            ],
                            [
                              1584.0,
                              927.0
                            ],
                            [
                              1584.0,
                              1038.24
                            ],
                            [
                              1728.0,
                              1038.24
                            ],
                            [
                              1728.0,
                              1149.48
                            ],
                            [
                              1440.0,
                              1149.48
                            ]
                          ],
                          "bbox": [
                            1440.0,
                            927.0,
                            288.0,
                            222.48
                          ],
                          "page": 0,
                          "shape": "outline",
                          "polygon_source": [
                            [
                              475.2,
                              305.91
                            ],
                            [
                              522.72,
                              305.91
                            ],
                            [
                              522.72,
                              342.6192
                            ],
                            [
                              570.24,
                              342.6192
                            ],
                            [
                              570.24,
                              379.3284
                            ],
                            [
                              475.2,
                              379.3284
                            ]
                          ],
                          "source_units": "pt"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 62.1,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "Sheet already in Kentucky AI"
                  },
                  "ImageResizedWithAutoScale": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        1224,
                        792
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              306.0,
                              197.88
                            ],
                            [
                              428.4,
                              197.88
                            ],
                            [
                              428.4,
                              237.46
                            ],
                            [
                              306.0,
                              237.46
                            ]
                          ],
                          "bbox": [
                            306.0,
                            197.88,
                            122.4,
                            39.58
                          ],
                          "page": 0,
                          "shape": "outline"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              734.4,
                              395.76
                            ],
                            [
                              807.84,
                              395.76
                            ],
                            [
                              807.84,
                              443.25
                            ],
                            [
                              881.28,
                              443.25
                            ],
                            [
                              881.28,
                              490.74
                            ],
                            [
                              734.4,
                              490.74
                            ]
                          ],
                          "bbox": [
                            734.4,
                            395.76,
                            146.88,
                            94.98
                          ],
                          "page": 0,
                          "shape": "outline"
                        }
                      ],
                      "image_scale_applied": 1.9608,
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 15.2,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "Image resized with auto_scale"
                  },
                  "BoxModel(polygonIsTheBox)": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "box",
                      "image_size": [
                        600,
                        400
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "box"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "box"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 2.7,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "Box model (polygon is the box)"
                  },
                  "PinnedToVersion2": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        600,
                        400
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              360.0,
                              200.0
                            ],
                            [
                              396.0,
                              200.0
                            ],
                            [
                              396.0,
                              224.0
                            ],
                            [
                              432.0,
                              224.0
                            ],
                            [
                              432.0,
                              248.0
                            ],
                            [
                              360.0,
                              248.0
                            ]
                          ],
                          "bbox": [
                            360.0,
                            200.0,
                            72.0,
                            48.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 2,
                      "latency_ms": 3.8,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "summary": "Pinned to version 2"
                  },
                  "ReplayOfAnEarlierIdempotency-Key": {
                    "value": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        600,
                        400
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              360.0,
                              200.0
                            ],
                            [
                              396.0,
                              200.0
                            ],
                            [
                              396.0,
                              224.0
                            ],
                            [
                              432.0,
                              224.0
                            ],
                            [
                              432.0,
                              248.0
                            ],
                            [
                              360.0,
                              248.0
                            ]
                          ],
                          "bbox": [
                            360.0,
                            200.0,
                            72.0,
                            48.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 4.3,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": true
                      }
                    },
                    "summary": "Replay of an earlier Idempotency-Key"
                  }
                }
              }
            },
            "description": "The answer. A replay of an earlier Idempotency-Key carries the same `X-RateLimit-*` headers (the current state; the replay does not use a call)."
          },
          "400": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ScoreThresholdOutOfRange": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "score_threshold must be a number from 0 to 1 (not a string or true/false)"
                      }
                    },
                    "summary": "score_threshold out of range"
                  },
                  "PdfPageThatDoesNotExist": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "page 9 does not exist: the PDF has 2 pages"
                      }
                    },
                    "summary": "pdf page that does not exist"
                  },
                  "TwoInputs": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "send exactly one of image, pdf, sheet_id"
                      }
                    },
                    "summary": "two inputs"
                  },
                  "Predict,BadVersion": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "version 9 does not exist for this deployment (available: 1, 2)"
                      }
                    },
                    "summary": "predict, bad version"
                  },
                  "CorruptImage": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "image could not be read (corrupt or truncated)"
                      }
                    },
                    "summary": "corrupt image"
                  },
                  "WrongType": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "sheet_id must be a whole number (an integer, not a string or true/false)"
                      }
                    },
                    "summary": "sheet_id as a string"
                  },
                  "WrongContent-Type": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "Content-Type must be application/json (send the request body as JSON)"
                      }
                    },
                    "summary": "wrong Content-Type"
                  }
                }
              }
            },
            "description": "The input is wrong: not JSON or sent with another Content-Type (there is no 415), not base64, not PNG/JPEG/PDF, a corrupt or truncated image, too large, a damaged PDF, a page that does not exist, a `sheet_id` that is not a whole number or not found, `score_threshold` that is not a number from 0 to 1, none or more than one of `image`/`pdf`/`sheet_id`, or a version you cannot pin. The message says which. Not counted as a deployment error."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Predict,NoKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "predict, no key"
                  }
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope. The answer carries `WWW-Authenticate: Bearer`."
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "SpendLimit": {
                    "value": {
                      "error": {
                        "code": "spend_limit",
                        "message": "Monthly spending limit reached. Raise it on the Billing page to continue."
                      }
                    },
                    "summary": "spend limit"
                  },
                  "PaymentRequired": {
                    "value": {
                      "error": {
                        "code": "payment_required",
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time."
                      }
                    },
                    "summary": "payment_required"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Predict,Turned-offKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page."
                      }
                    },
                    "summary": "predict, turned-off key"
                  },
                  "NotAdded": {
                    "value": {
                      "error": {
                        "code": "not_added",
                        "message": "Add this model to My models first (Explore models, then Add to My models). Calls are billed to your company."
                      }
                    },
                    "summary": "not_added"
                  }
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`). Ready-made models: your company has not added this model to My models (`not_added`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Predict,UnknownDeployment": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "deployment not found"
                      }
                    },
                    "summary": "predict, unknown deployment"
                  }
                }
              }
            },
            "description": "No such deployment, or one your key cannot use."
          },
          "409": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Paused": {
                    "value": {
                      "error": {
                        "code": "paused",
                        "message": "deployment is paused"
                      }
                    },
                    "summary": "paused"
                  }
                }
              }
            },
            "description": "The deployment is paused. Resume it on the Deployments page."
          },
          "422": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Idempotency-KeyWithAnotherBody": {
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request. Use a new key for a new request."
                      }
                    },
                    "summary": "Idempotency-Key with another body"
                  }
                }
              }
            },
            "description": "This `Idempotency-Key` was already used for a different request. Use a new key for a new request."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model.",
                "required": true
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit.",
                "required": true
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RateLimited": {
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "limit 1/min for this API key on this deployment"
                      }
                    },
                    "summary": "rate limited"
                  }
                }
              }
            },
            "description": "A rate limit was reached. Wait `Retry-After` seconds, then send the call again. A call that fails still counts against the limit. The same 429 (code `concurrency_limit`, `quota_exceeded` or `team_quota_exceeded`) is answered when your company or team has as many calls running as it may (after waiting up to 20 s in a fair queue) or its monthly quota is used up; then X-RateLimit-Remaining is the per-minute state, not 0. For many sheets use a batch."
          },
          "500": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ModelFailure": {
                    "value": {
                      "error": {
                        "code": "inference_failed",
                        "message": "The model could not process this input. Try again, or send a different sheet."
                      }
                    },
                    "summary": "model failure"
                  }
                }
              }
            },
            "description": "The model could not process this input. Try again, or send a different sheet. Counts as a deployment error and is not billed."
          },
          "503": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Overloaded": {
                    "value": {
                      "error": {
                        "code": "overloaded",
                        "message": "The platform is busy right now. Retry shortly."
                      }
                    },
                    "summary": "overloaded"
                  },
                  "Unavailable": {
                    "value": {
                      "error": {
                        "code": "unavailable",
                        "message": "This model is not available right now. Try again later."
                      }
                    },
                    "summary": "unavailable"
                  }
                }
              }
            },
            "description": "The platform is full right now (`overloaded`) or the model did not answer in time (`inference_timeout`). Nothing was billed. Wait Retry-After seconds and send it again. Ready-made models: The model is offered but cannot answer right now."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ModelRetired": {
                    "value": {
                      "error": {
                        "code": "model_retired",
                        "message": "This model is no longer offered. Remove it from My models, or pick another one on Explore models."
                      }
                    },
                    "summary": "model_retired"
                  }
                }
              }
            },
            "description": "The model was offered but is not any more."
          }
        }
      }
    },
    "/models/{slug}/jobs": {
      "post": {
        "operationId": "createPredictJob",
        "description": "Same body (and the same checks, run before anything is queued: a body predict would refuse is a 400 here too), key, limits, `?version=`, Idempotency-Key and billing as `POST .../predict`, plus an optional `webhook_url`. Answers `202` at once with the job; poll `GET /jobs/{uid}` (or wait for the webhook) until `status` is `succeeded` (the answer is under `result`, exactly what predict returns) or `failed` (see `error`).\n\nA job is billed once, when it succeeds; a job that fails is not billed. The version is pinned when the job is accepted. A repeated `Idempotency-Key` with the same body returns the first job with `200` and never queues, runs or bills a second one; with a different body it is a 422 `idempotency_key_reused`, as for predict. `status_url` is a full address (`https://host/api/ka/v1/jobs/{id}`): call it as it is.\n\n`webhook_url` must be https and point to a public host (no username or password, no address inside a private network). When the job ends, in either way, we POST the job JSON to it with a 10 second timeout and no redirects (see the `jobFinished` webhook). A POST that fails (network error, timeout, 5xx, 408 or 429) is retried up to 3 more times, after 10 s, 60 s and 300 s; the job's `webhook` object shows `state` (`retrying` between tries), `attempts` and `next_attempt_at`. Treat it as a nudge: if it never arrives, poll. Jobs and batches run on your own models; for a ready-made model this answers 400: send each sheet to `/models/{slug}/predict`.",
        "summary": "Predict in the background (job)",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            },
            "description": "Any string you choose, unique per request (a sheet name works). A retry with the same key and body returns the first answer and is billed once; the same key with a different body is a 422. Kept 24 hours (per web process unless a shared cache is configured; billing is never doubled)."
          },
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "description": "The model's address name (slug), as shown on its page in My models: one of your own models or a ready-made model your company added.",
            "required": true
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Pin a model version number instead of the active one. Only ready versions of the deployment's own model can be pinned; anything else is a 400 that lists the versions you can use. A pinned and an unpinned call with the same Idempotency-Key are different requests."
          }
        ],
        "tags": [
          "Jobs"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobRequest"
              },
              "examples": {
                "PDFPage1": {
                  "value": {
                    "pdf": "JVBERi0xLjcNCiWhs8XXDQoxIDAgb2JqDQo8PC9QYWdlcyAyIDAgUiAvVHlwZS9DYXRhbG9nPj4NCmVuZG9iag0KMiAwIG9iag0KPDwvQ291bnQgMi9LaWRzWyA0IDAgUiAgNSAwIFIgXS9UeXBlL1BhZ2VzPj4NCmVuZG9iag0KMyAwIG9iag0KPDwvQ3JlYXRpb25EYXRlKEQ6MjAyNjExMTYxMTM3NDIrMDAnMDAnKS9DcmVhdG9yKFBERml1bSk+Pg0KZW5kb2JqDQo0IDAgb2JqDQo8PC9NZWRpYUJveFsgMCAwIDYxMiA3OTJdL1BhcmVudCAyIDAgUiAvUmVzb3VyY2VzPDw+Pi9Sb3RhdGUgMC9UeXBlL1BhZ2U+Pg0KZW5kb2JqDQo1IDAgb2JqDQo8PC9NZWRpYUJveFsgMCAwIDg0MiA1OTVdL1BhcmVudCAyIDAgUiAvUmVzb3VyY2VzPDw+Pi9Sb3RhdGUgMC9UeXBlL1BhZ2U+Pg0KZW5kb2JqDQp4cmVmDQowIDYNCjAwMDAwMDAwMDAgNjU1MzUgZg0KMDAwMDAwMDAxNyAwMDAwMCBuDQowMDAwMDAwMDY2IDAwMDAwIG4NCjAwMDAwMDAxMjkgMDAwMDAgbg0KMDAwMDAwMDIwNiAwMDAwMCBuDQowMDAwMDAwMjk5IDAwMDAwIG4NCnRyYWlsZXINCjw8DQovUm9vdCAxIDAgUg0KL0luZm8gMyAwIFINCi9TaXplIDYvSURbPDQ2RERGQjQ5MUZENzE5QjUyQzY3MzYxNUJGREFCNzA5Pjw0NkRERkI0OTFGRDcxOUI1MkM2NzM2MTVCRkRBQjcwOT5dPj4NCnN0YXJ0eHJlZg0KMzkyDQolJUVPRg0K",
                    "page": 1
                  },
                  "summary": "PDF page 1"
                },
                "ImageWithAWebhook": {
                  "value": {
                    "image": "iVBORw0KGgoAAAANSUhEUgAAAlgAAAGQCAIAAAD9V4nPAAAF+UlEQVR4nO3VMQEAIAzAMMC/5yFjRxMF/Xpn5gBA1dsOAIBNRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkGaEAKQZIQBpRghAmhECkPYBFhIGHZ9D6k8AAAAASUVORK5CYII=",
                    "webhook_url": "https://hooks.example.com/ka"
                  },
                  "summary": "Image with a webhook"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "examples": {
                  "Queued": {
                    "value": {
                      "id": "job_6bd310c01f034de5",
                      "status": "queued",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_6bd310c01f034de5",
                      "created_at": "2026-11-16T11:37:44.511778Z",
                      "started_at": null,
                      "completed_at": null
                    },
                    "summary": "Queued"
                  },
                  "Queued,WithAWebhook": {
                    "value": {
                      "id": "job_392852aed5ba433d",
                      "status": "queued",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_392852aed5ba433d",
                      "created_at": "2026-11-16T11:37:44.536595Z",
                      "started_at": null,
                      "completed_at": null,
                      "webhook": {
                        "state": "pending"
                      }
                    },
                    "summary": "Queued, with a webhook"
                  }
                }
              }
            },
            "description": "Accepted: queued. Poll `status_url`."
          },
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "examples": {
                  "TheFirstJobAgain": {
                    "value": {
                      "id": "job_6bd310c01f034de5",
                      "status": "queued",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_6bd310c01f034de5",
                      "created_at": "2026-11-16T11:37:44.511778Z",
                      "started_at": null,
                      "completed_at": null
                    },
                    "summary": "The first job again"
                  }
                }
              }
            },
            "description": "An earlier job with the same `Idempotency-Key` (and the same `?version=` pin). Nothing was queued, run or billed. No rate limit headers. Carries the current `X-RateLimit-*` (a replay does not use a call)."
          },
          "400": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "JobWebhookUrlNotHttps": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "webhook_url must be a https URL without a username or password"
                      }
                    },
                    "summary": "job webhook_url not https"
                  },
                  "Jobs,BadInput": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "page must be a whole number, 1 or more (the first page is 1)"
                      }
                    },
                    "summary": "jobs, bad input"
                  }
                }
              }
            },
            "description": "Same input checks as predict (run before the job is queued), plus `webhook_url` that is not a https URL to a public host."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Jobs,NoKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "jobs, no key"
                  }
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "SpendLimitOnJobs": {
                    "value": {
                      "error": {
                        "code": "spend_limit",
                        "message": "Monthly spending limit reached. Raise it on the Billing page to continue."
                      }
                    },
                    "summary": "spend limit on jobs"
                  },
                  "PaymentRequired": {
                    "value": {
                      "error": {
                        "code": "payment_required",
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time."
                      }
                    },
                    "summary": "payment_required"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Jobs,Turned-offKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page."
                      }
                    },
                    "summary": "jobs, turned-off key"
                  }
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Jobs,UnknownDeployment": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "deployment not found"
                      }
                    },
                    "summary": "jobs, unknown deployment"
                  }
                }
              }
            },
            "description": "No such deployment, or one your key cannot use."
          },
          "409": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "PausedJobs": {
                    "value": {
                      "error": {
                        "code": "paused",
                        "message": "deployment is paused"
                      }
                    },
                    "summary": "paused jobs"
                  }
                }
              }
            },
            "description": "The deployment is paused. Resume it on the Deployments page."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model.",
                "required": true
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit.",
                "required": true
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RateLimitedJobs": {
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "limit 1/min for this API key on this deployment"
                      }
                    },
                    "summary": "rate limited jobs"
                  }
                }
              }
            },
            "description": "A rate limit was reached. Wait `Retry-After` seconds, then send the call again. A call that fails still counts against the limit."
          },
          "422": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Idempotency-KeyWithAnotherBody": {
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request. Use a new key for a new request."
                      }
                    },
                    "summary": "Idempotency-Key with another body"
                  }
                }
              }
            },
            "description": "This `Idempotency-Key` was already used for a different request. Use a new key for a new request."
          }
        }
      }
    },
    "/jobs/{uid}": {
      "get": {
        "operationId": "getPredictJob",
        "description": "Poll every few seconds (the client uses 5). A job is `queued`, `running`, then `succeeded` (`result` is exactly what predict returns) or `failed` (`error`). Polling is not rate limited. Keys limited to some deployments only see those deployments' jobs.",
        "summary": "Job status and result",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The job `id`, like `job_cc4927110c1d4b07`.",
            "required": true
          }
        ],
        "tags": [
          "Jobs"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "examples": {
                  "Queued": {
                    "value": {
                      "id": "job_6bd310c01f034de5",
                      "status": "queued",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_6bd310c01f034de5",
                      "created_at": "2026-11-16T11:37:44.511778Z",
                      "started_at": null,
                      "completed_at": null
                    },
                    "summary": "Queued"
                  },
                  "Succeeded": {
                    "value": {
                      "id": "job_6bd310c01f034de5",
                      "status": "succeeded",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_6bd310c01f034de5",
                      "created_at": "2026-11-16T11:37:44.511778Z",
                      "started_at": "2026-11-16T11:37:44.540505Z",
                      "completed_at": "2026-11-16T11:37:44.599012Z",
                      "result": {
                        "task": "instance_segmentation",
                        "shape": "outline",
                        "image_size": [
                          1855,
                          2400
                        ],
                        "sheet_id": null,
                        "predictions": [
                          {
                            "label": "door",
                            "confidence": 0.9231,
                            "polygon": [
                              [
                                463.5,
                                600.0
                              ],
                              [
                                648.9,
                                600.0
                              ],
                              [
                                648.9,
                                720.0
                              ],
                              [
                                463.5,
                                720.0
                              ]
                            ],
                            "bbox": [
                              463.5,
                              600.0,
                              185.4,
                              120.0
                            ],
                            "page": 0,
                            "shape": "outline",
                            "polygon_source": [
                              [
                                152.955,
                                198.0
                              ],
                              [
                                214.137,
                                198.0
                              ],
                              [
                                214.137,
                                237.6
                              ],
                              [
                                152.955,
                                237.6
                              ]
                            ],
                            "source_units": "pt"
                          },
                          {
                            "label": "window",
                            "confidence": 0.8107,
                            "polygon": [
                              [
                                1112.4,
                                1200.0
                              ],
                              [
                                1223.64,
                                1200.0
                              ],
                              [
                                1223.64,
                                1344.0
                              ],
                              [
                                1334.88,
                                1344.0
                              ],
                              [
                                1334.88,
                                1488.0
                              ],
                              [
                                1112.4,
                                1488.0
                              ]
                            ],
                            "bbox": [
                              1112.4,
                              1200.0,
                              222.48,
                              288.0
                            ],
                            "page": 0,
                            "shape": "outline",
                            "polygon_source": [
                              [
                                367.092,
                                396.0
                              ],
                              [
                                403.8012,
                                396.0
                              ],
                              [
                                403.8012,
                                443.52
                              ],
                              [
                                440.5104,
                                443.52
                              ],
                              [
                                440.5104,
                                491.04
                              ],
                              [
                                367.092,
                                491.04
                              ]
                            ],
                            "source_units": "pt"
                          }
                        ],
                        "pdf": {
                          "px_per_pt": 3.0303030303030303,
                          "page_size_pt": [
                            612.0,
                            792.0
                          ]
                        },
                        "counts": {
                          "door": 1,
                          "window": 1
                        },
                        "deployment": "dep-a",
                        "model_version_number": 1,
                        "latency_ms": 50.5,
                        "usage": {
                          "requests": 1,
                          "charge_usd": "0.003000",
                          "duplicate_request": false
                        }
                      }
                    },
                    "summary": "Succeeded"
                  },
                  "Succeeded,WebhookDelivered": {
                    "value": {
                      "id": "job_392852aed5ba433d",
                      "status": "succeeded",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_392852aed5ba433d",
                      "created_at": "2026-11-16T11:37:44.536595Z",
                      "started_at": "2026-11-16T11:37:44.601941Z",
                      "completed_at": "2026-11-16T11:37:44.613438Z",
                      "result": {
                        "task": "instance_segmentation",
                        "shape": "outline",
                        "image_size": [
                          600,
                          400
                        ],
                        "sheet_id": null,
                        "predictions": [
                          {
                            "label": "door",
                            "confidence": 0.9231,
                            "polygon": [
                              [
                                150.0,
                                100.0
                              ],
                              [
                                210.0,
                                100.0
                              ],
                              [
                                210.0,
                                120.0
                              ],
                              [
                                150.0,
                                120.0
                              ]
                            ],
                            "bbox": [
                              150.0,
                              100.0,
                              60.0,
                              20.0
                            ],
                            "page": 0,
                            "shape": "outline"
                          },
                          {
                            "label": "window",
                            "confidence": 0.8107,
                            "polygon": [
                              [
                                360.0,
                                200.0
                              ],
                              [
                                396.0,
                                200.0
                              ],
                              [
                                396.0,
                                224.0
                              ],
                              [
                                432.0,
                                224.0
                              ],
                              [
                                432.0,
                                248.0
                              ],
                              [
                                360.0,
                                248.0
                              ]
                            ],
                            "bbox": [
                              360.0,
                              200.0,
                              72.0,
                              48.0
                            ],
                            "page": 0,
                            "shape": "outline"
                          }
                        ],
                        "counts": {
                          "door": 1,
                          "window": 1
                        },
                        "deployment": "dep-a",
                        "model_version_number": 1,
                        "latency_ms": 5.7,
                        "usage": {
                          "requests": 1,
                          "charge_usd": "0.003000",
                          "duplicate_request": false
                        }
                      },
                      "webhook": {
                        "state": "delivered"
                      }
                    },
                    "summary": "Succeeded, webhook delivered"
                  },
                  "Failed": {
                    "value": {
                      "id": "job_b8c65eb7d1864e9f",
                      "status": "failed",
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/jobs/job_b8c65eb7d1864e9f",
                      "created_at": "2026-11-16T11:37:44.691358Z",
                      "started_at": "2026-11-16T11:37:44.695945Z",
                      "completed_at": "2026-11-16T11:37:44.701434Z",
                      "error": {
                        "code": "inference_failed",
                        "message": "The model could not process this input. Try again, or send a different sheet."
                      }
                    },
                    "summary": "Failed"
                  }
                }
              }
            },
            "description": "The job."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Job,NoKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "job, no key"
                  }
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Job,Turned-offKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page."
                      }
                    },
                    "summary": "job, turned-off key"
                  }
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Job,UnknownId": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "job not found"
                      }
                    },
                    "summary": "job, unknown id"
                  }
                }
              }
            },
            "description": "No such job, or a job of another organization or of a deployment your key cannot use."
          }
        }
      }
    },
    "/models/{slug}/batches": {
      "post": {
        "operationId": "createPredictBatch",
        "description": "Up to 1000 sheets (PDF pages, images, sheet ids or public https URLs) for one model in one request. Every item is checked first (a bad item is a 400 for the whole batch, nothing queued). Answers 202 at once; the items run in the background after interactive calls, fair across companies, and each is billed like one predict call when it succeeds (included in warm GPU hours where the hosting rules say so). Poll `status_url`, download `results_url` (JSON lines), or give `webhook_url`: it gets the batch JSON once every item has ended, signed with your company's webhook secret: header `X-KA-Signature: t=<unix>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">`. Same key, limits, `?version=` and Idempotency-Key rules as jobs; one request counts once toward the per-minute limits. Jobs and batches run on your own models; for a ready-made model this answers 400: send each sheet to `/models/{slug}/predict`.",
        "summary": "Predict many sheets (batch)",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            },
            "description": "Any string you choose, unique per request (a sheet name works). A retry with the same key and body returns the first answer and is billed once; the same key with a different body is a 422. Kept 24 hours (per web process unless a shared cache is configured; billing is never doubled)."
          },
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string"
            },
            "description": "The model's address name (slug), as shown on its page in My models: one of your own models or a ready-made model your company added.",
            "required": true
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Pin a model version number instead of the active one. Only ready versions of the deployment's own model can be pinned; anything else is a 400 that lists the versions you can use. A pinned and an unpinned call with the same Idempotency-Key are different requests."
          }
        ],
        "tags": [
          "Batches"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            },
            "description": "Queued."
          },
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            },
            "description": "The first batch of this Idempotency-Key."
          },
          "400": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "BadRequest": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "items[0]: send exactly one of image, pdf, sheet_id, graph, url"
                      }
                    },
                    "summary": "bad_request"
                  }
                }
              }
            },
            "description": "items[0]: send exactly one of image, pdf, sheet_id, graph, url"
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "Bearer API key with inference scope required"
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "SpendLimit": {
                    "value": {
                      "error": {
                        "code": "spend_limit",
                        "message": "Monthly spending limit reached."
                      }
                    },
                    "summary": "spend_limit"
                  },
                  "PaymentRequired": {
                    "value": {
                      "error": {
                        "code": "payment_required",
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time."
                      }
                    },
                    "summary": "payment_required"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "key not allowed"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "key not allowed"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotFound": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "deployment not found"
                      }
                    },
                    "summary": "not_found"
                  }
                }
              }
            },
            "description": "deployment not found"
          },
          "409": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Paused": {
                    "value": {
                      "error": {
                        "code": "paused",
                        "message": "deployment is paused"
                      }
                    },
                    "summary": "paused"
                  }
                }
              }
            },
            "description": "deployment is paused"
          },
          "422": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "IdempotencyKeyReused": {
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request."
                      }
                    },
                    "summary": "idempotency_key_reused"
                  }
                }
              }
            },
            "description": "This Idempotency-Key was already used for a different request."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model.",
                "required": true
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit.",
                "required": true
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "RateLimited": {
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "limit 60/min for this deployment"
                      }
                    },
                    "summary": "rate_limited"
                  }
                }
              }
            },
            "description": "limit 60/min for this deployment"
          }
        }
      }
    },
    "/batches/{uid}": {
      "get": {
        "operationId": "getPredictBatch",
        "description": "Counts of queued, running, succeeded, failed and cancelled items. Polling is not rate limited.",
        "summary": "Batch progress",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The batch `id`, like `bat_1c9a0e4f5d2b4a77`.",
            "required": true
          }
        ],
        "tags": [
          "Batches"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            },
            "description": "The batch."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "Bearer API key with inference scope required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "key not allowed"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "key not allowed"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotFound": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "batch not found"
                      }
                    },
                    "summary": "not_found"
                  }
                }
              }
            },
            "description": "batch not found"
          }
        }
      }
    },
    "/batches/{uid}/results": {
      "get": {
        "operationId": "getPredictBatchResults",
        "description": "One JSON object per line, per item in item order: `{index, job, status, result}` (result = exactly what predict returns) or `{..., error}`. Download it at any time; items still queued or running show only their status.",
        "summary": "Batch results (JSON lines)",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The batch `id`, like `bat_1c9a0e4f5d2b4a77`.",
            "required": true
          }
        ],
        "tags": [
          "Batches"
        ],
        "responses": {
          "200": {
            "description": "The results file, `Content-Type: application/x-ndjson` (JSON lines), one line per item."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "Bearer API key with inference scope required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "key not allowed"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "key not allowed"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotFound": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "batch not found"
                      }
                    },
                    "summary": "not_found"
                  }
                }
              }
            },
            "description": "batch not found"
          }
        }
      }
    },
    "/batches/{uid}/cancel": {
      "post": {
        "operationId": "cancelPredictBatch",
        "description": "Items not started yet are stopped and never billed; items already running finish.",
        "summary": "Cancel a batch",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The batch `id`, like `bat_1c9a0e4f5d2b4a77`.",
            "required": true
          }
        ],
        "tags": [
          "Batches"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            },
            "description": "The batch, with `cancelled_items`."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "Bearer API key with inference scope required"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "key not allowed"
                      }
                    },
                    "summary": "unauthorized"
                  }
                }
              }
            },
            "description": "key not allowed"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotFound": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "batch not found"
                      }
                    },
                    "summary": "not_found"
                  }
                }
              }
            },
            "description": "batch not found"
          }
        }
      }
    },
    "/models": {
      "get": {
        "operationId": "listModels",
        "description": "The OpenAI list form (`client.models.list()` in the OpenAI SDK): your own models that are online (`kind: \"yours\"`), the ready-made models your company added (`kentucky`, `marketplace`) and the language models in My models (`llm`) with your price per 1M tokens, context window, output limit and abilities. Extensions your company added (`kind: \"extension\"`: the Plan Indexer, `id: \"plan-indexer\"`, with its page prices; Teams, `id: \"teams\"`, with its seats, listed only while its seats are paid) are listed so an app connected with the key knows to turn them on. A key limited to some models lists only those; language models of an origin your company blocks are left out.",
        "summary": "List the models your key can call",
        "tags": [
          "Language models"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmModelList"
                },
                "examples": {
                  "List": {
                    "value": {
                      "object": "list",
                      "data": [
                        {
                          "id": "claude-sonnet-5-5",
                          "object": "model",
                          "created": 1794955828,
                          "owned_by": "Anthropic",
                          "kind": "llm",
                          "name": "Claude Sonnet 5.5",
                          "endpoint": "/api/ka/v1/chat/completions",
                          "context_window": 200000,
                          "max_output_tokens": 64000,
                          "origin": "US",
                          "categories": [
                            "Intelligent"
                          ],
                          "capabilities": {
                            "streaming": true,
                            "tools": true,
                            "vision": true
                          },
                          "pricing": {
                            "input_per_mtok_usd": "2.300000",
                            "cached_input_per_mtok_usd": "0.230000",
                            "output_per_mtok_usd": "11.500000",
                            "min_per_request_usd": "0.000000"
                          }
                        },
                        {
                          "id": "plan-indexer",
                          "object": "model",
                          "created": 1794955900,
                          "owned_by": "Kentucky AI",
                          "kind": "extension",
                          "name": "Plan Indexer",
                          "endpoint": "/api/ka/v1/indexer/jobs",
                          "page_prices": {
                            "drawing_page_usd": "0.03",
                            "spec_page_usd": "0.03"
                          }
                        }
                      ]
                    },
                    "summary": "list"
                  }
                }
              }
            },
            "description": "The list."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "message": "An API key is required: Authorization: Bearer ka_... (make one on the API keys page).",
                        "type": "authentication_error",
                        "code": "unauthorized",
                        "param": null
                      }
                    },
                    "summary": "unauthorized"
                  },
                  "InvalidApiKey": {
                    "value": {
                      "error": {
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page.",
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "param": null
                      }
                    },
                    "summary": "invalid_api_key"
                  }
                }
              }
            },
            "description": "No API key (`unauthorized`), or a wrong or turned-off key (`invalid_api_key`). Unlike the drawing-model addresses, a wrong key is a 401 here, as the OpenAI and Anthropic SDKs expect."
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "description": "The OpenAI Chat Completions API. Point any OpenAI SDK at `base_url = https://<host>/api/ka/v1` with your Kentucky AI key and set `model` to the slug of a language model in your My models (`GET /models` lists them; Explore models › LLMs shows them). Your code stays the same.\n\n**What is passed through.** `messages`, `max_tokens` / `max_completion_tokens`, `stream`, `temperature`, `top_p`, `n`, `stop`, `presence_penalty`, `frequency_penalty`, `logit_bias`, `logprobs`, `top_logprobs`, `seed`, `response_format`, `tools`, `tool_choice`, `parallel_tool_calls`, `user`, `reasoning_effort`, `modalities`, `functions`, `function_call`. Anything else in the body is ignored. `max_tokens` left out is 4096, and never more than the model's `max_output_tokens`.\n\n**Images and PDFs.** Images as `image_url` parts (a `data:image/...;base64,` URL or an https URL). A PDF as a `file` part (`file_data: \"data:application/pdf;base64,...\"`) or a PDF data URL in `image_url` is sent to the model as one PNG per page (the first 5 pages, longest side 1568 px). The model must take images (`capabilities.vision`).\n\n**Streaming.** `\"stream\": true` answers `text/event-stream`: `data: {chat.completion.chunk}` events, then `data: [DONE]`. With `stream_options.include_usage` the last chunk carries `usage`. A provider error mid-stream arrives as one `data: {\"error\": {...}}` event and the stream ends without `[DONE]`. Hanging up stops the generation; the tokens made so far are billed.\n\n**Billing.** Per token, at your price per 1M input, cached input and output tokens (`GET /models` → `pricing`), at least the model's minimum per request when it has one; a long prompt past `long_from_tokens` is billed at the model's long-prompt prices (`GET /models/{slug}` → `llm`). `X-KA-Charge-USD` on the answer says what this call cost. Before the call, its largest possible cost (the prompt plus `max_tokens`) must fit your monthly spending limit.\n\n**Prompt caching** is on: OpenAI and Gemini models cache on their own; for Anthropic models a cache breakpoint is added to a long stable prefix unless you set your own `cache_control`, which is passed through untouched. Cached prompt tokens are billed at the cached price.\n\n**Limits.** The same key, team, rate limits, calls at once, quotas and spending limits as every other call. A rate limit applies per company per model (60 a minute unless the model sets another) and per key when the key has its own.\n\n**Fallbacks.** On My models a company owner or admin can give each language model up to 2 other language models, tried in order when this one cannot answer for a reason that is not yours: the provider timed out (`provider_timeout`), failed or could not be reached (`provider_error`, `provider_unavailable`), was busy (`provider_rate_limited`), or the model was paused, retired or its origin blocked after you added it. Never for your own errors (400, `context_length_exceeded`, `content_policy_violation`), billing (402), our rate limits and quotas (429) or the key (401). A fallback that cannot take this call (images, tools or streaming it does not support, a key that cannot call it) is skipped. A call can send its own list as `\"fallbacks\": [\"slug-b\", \"slug-c\"]` (with an OpenAI SDK: `extra_body`); it replaces the saved one for this call, and `[]` means none. A stream falls back only before its first byte is sent. The answer from a fallback has `model` set to the fallback's slug and the header `X-KA-Fallback-From` set to the slug you called; it is billed once, at the fallback's prices. Before the call, the spending limit must fit the dearest model that could answer.",
        "summary": "Chat with a language model (OpenAI-compatible)",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Send the same key again (same body) to get the first answer again, free, for 24 hours; a streamed answer is replayed as the same stream. While the first call still runs, a repeat is a 409 `idempotency_in_progress`; the same key with a different body is a 422 `idempotency_key_reused`."
          }
        ],
        "tags": [
          "Language models"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "examples": {
                "Text": {
                  "value": {
                    "model": "claude-sonnet-5-5",
                    "messages": [
                      {
                        "role": "user",
                        "content": "How many doors are on sheet A101?"
                      }
                    ],
                    "max_tokens": 500
                  },
                  "summary": "text"
                },
                "Image": {
                  "value": {
                    "model": "claude-sonnet-5-5",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "Count the doors."
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "data:image/png;base64,iVBORw0KGgo="
                            }
                          }
                        ]
                      }
                    ],
                    "stream": true
                  },
                  "summary": "image"
                },
                "Pdf": {
                  "value": {
                    "model": "claude-sonnet-5-5",
                    "max_tokens": 800,
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "List the door types in the schedule."
                          },
                          {
                            "type": "file",
                            "file": {
                              "filename": "A-601.pdf",
                              "file_data": "data:application/pdf;base64,JVBERi0xLjcK..."
                            }
                          }
                        ]
                      }
                    ]
                  },
                  "summary": "a PDF (sent as page images)"
                },
                "Tools": {
                  "value": {
                    "model": "claude-sonnet-5-5",
                    "messages": [
                      {
                        "role": "user",
                        "content": "How many doors are on A101?"
                      }
                    ],
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "count_items",
                          "description": "Count items of a type on a sheet.",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "sheet": {
                                "type": "string"
                              },
                              "item": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "sheet",
                              "item"
                            ]
                          }
                        }
                      }
                    ]
                  },
                  "summary": "tools"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "X-KA-Charge-USD": {
                "schema": {
                  "type": "string"
                },
                "description": "What this call was billed, in USD (a decimal string)."
              },
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present on an answer replayed for a repeated `Idempotency-Key` (billed once, with the first call)."
              },
              "X-KA-Fallback-From": {
                "schema": {
                  "type": "string"
                },
                "description": "Present when a fallback answered: the slug of the model you called, which could not answer. `model` names the one that did."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                },
                "examples": {
                  "Answer": {
                    "value": {
                      "id": "chatcmpl-1",
                      "object": "chat.completion",
                      "created": 1794955828,
                      "model": "claude-sonnet-5-5",
                      "choices": [
                        {
                          "index": 0,
                          "message": {
                            "role": "assistant",
                            "content": "Sheet A101 shows 14 doors."
                          },
                          "finish_reason": "stop"
                        }
                      ],
                      "usage": {
                        "prompt_tokens": 1840,
                        "completion_tokens": 12,
                        "total_tokens": 1852,
                        "prompt_tokens_details": {
                          "cached_tokens": 1024
                        }
                      }
                    },
                    "summary": "answer"
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events: `data: <ChatCompletionChunk JSON>` lines, then `data: [DONE]`."
                },
                "examples": {
                  "Stream": {
                    "value": "data: {\"id\":\"chatcmpl-1\",\"object\":\"chat.completion.chunk\",\"created\":1794955828,\"model\":\"claude-sonnet-5-5\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"Sheet A101 \"}}]}\n\ndata: {\"id\":\"chatcmpl-1\",\"object\":\"chat.completion.chunk\",\"created\":1794955828,\"model\":\"claude-sonnet-5-5\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"shows 14 doors.\"}}]}\n\ndata: {\"id\":\"chatcmpl-1\",\"object\":\"chat.completion.chunk\",\"created\":1794955828,\"model\":\"claude-sonnet-5-5\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n",
                    "summary": "stream"
                  }
                }
              }
            },
            "description": "The answer in the OpenAI form; `model` is the slug you called and `usage` the tokens billed. With `\"stream\": true`, an SSE stream (`text/event-stream`). A replay of an `Idempotency-Key` answers the first result again (also a stream), free, with `Idempotent-Replayed: true`."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "InvalidRequest": {
                    "value": {
                      "error": {
                        "message": "\"messages\" must be a non-empty list of {role, content} objects.",
                        "type": "invalid_request_error",
                        "code": "invalid_request",
                        "param": "messages"
                      }
                    },
                    "summary": "invalid_request"
                  },
                  "NotALanguageModel": {
                    "value": {
                      "error": {
                        "message": "\"doors-v3\" is one of your own models: send sheets to /api/ka/v1/models/doors-v3/predict.",
                        "type": "invalid_request_error",
                        "code": "not_a_language_model",
                        "param": "model"
                      }
                    },
                    "summary": "not_a_language_model"
                  },
                  "StreamNotSupported": {
                    "value": {
                      "error": {
                        "message": "This model does not stream. Send the request without \"stream\": true.",
                        "type": "invalid_request_error",
                        "code": "stream_not_supported",
                        "param": "stream"
                      }
                    },
                    "summary": "stream_not_supported"
                  },
                  "ToolsNotSupported": {
                    "value": {
                      "error": {
                        "message": "This model does not take tools / function calls.",
                        "type": "invalid_request_error",
                        "code": "tools_not_supported",
                        "param": "tools"
                      }
                    },
                    "summary": "tools_not_supported"
                  },
                  "VisionNotSupported": {
                    "value": {
                      "error": {
                        "message": "This model does not take images.",
                        "type": "invalid_request_error",
                        "code": "vision_not_supported",
                        "param": "messages"
                      }
                    },
                    "summary": "vision_not_supported"
                  },
                  "ContextLengthExceeded": {
                    "value": {
                      "error": {
                        "message": "prompt is too long: 203911 tokens > 200000 maximum (the provider's words)",
                        "type": "invalid_request_error",
                        "code": "context_length_exceeded",
                        "param": null
                      }
                    },
                    "summary": "context_length_exceeded"
                  }
                }
              }
            },
            "description": "The body is wrong, the model lacks a capability you asked for (streaming, tools, images), or the provider refused the request."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "message": "An API key is required: Authorization: Bearer ka_... (make one on the API keys page).",
                        "type": "authentication_error",
                        "code": "unauthorized",
                        "param": null
                      }
                    },
                    "summary": "unauthorized"
                  },
                  "InvalidApiKey": {
                    "value": {
                      "error": {
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page.",
                        "type": "authentication_error",
                        "code": "invalid_api_key",
                        "param": null
                      }
                    },
                    "summary": "invalid_api_key"
                  }
                }
              }
            },
            "description": "No API key (`unauthorized`), or a wrong or turned-off key (`invalid_api_key`). Unlike the drawing-model addresses, a wrong key is a 401 here, as the OpenAI and Anthropic SDKs expect."
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "PaymentRequired": {
                    "value": {
                      "error": {
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time.",
                        "type": "insufficient_quota",
                        "code": "payment_required",
                        "param": null
                      }
                    },
                    "summary": "payment_required"
                  },
                  "SpendLimit": {
                    "value": {
                      "error": {
                        "message": "This would go over your monthly limit of $100.00: $99.80 is already used or set aside this month, and this needs up to $0.65. Raise the limit on the Billing page to go ahead. (A language-model call is checked for its largest possible cost: lower max_tokens to send a smaller one.)",
                        "type": "insufficient_quota",
                        "code": "spend_limit",
                        "param": null
                      }
                    },
                    "summary": "spend_limit"
                  },
                  "TeamSpendLimit": {
                    "value": {
                      "error": {
                        "message": "Monthly spending limit of team \"estimating\" reached ($200.00). A company admin can raise it.",
                        "type": "insufficient_quota",
                        "code": "team_spend_limit",
                        "param": null
                      }
                    },
                    "summary": "team_spend_limit"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the call's largest possible cost (its input plus `max_tokens`) would pass the company's monthly spending limit (lower `max_tokens`, or raise the limit on the Billing page). `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing was sent to the model and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "NotAdded": {
                    "value": {
                      "error": {
                        "message": "Add this model to My models first (Explore models, then Add to My models). Calls are billed to your company.",
                        "type": "permission_error",
                        "code": "not_added",
                        "param": "model"
                      }
                    },
                    "summary": "not_added"
                  },
                  "OriginBlocked": {
                    "value": {
                      "error": {
                        "message": "Your company has blocked models of origin \"China\". A company admin can change this on Explore models (Language models, Origins).",
                        "type": "permission_error",
                        "code": "origin_blocked",
                        "param": null
                      }
                    },
                    "summary": "origin_blocked"
                  }
                }
              }
            },
            "description": "The model is not in your My models, or your company blocks its origin."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "ModelNotFound": {
                    "value": {
                      "error": {
                        "message": "The model \"claude-sonet\" does not exist. GET /api/ka/v1/models lists the ones your key can call.",
                        "type": "not_found_error",
                        "code": "model_not_found",
                        "param": "model"
                      }
                    },
                    "summary": "model_not_found"
                  }
                }
              }
            },
            "description": "`model_not_found`: no model has this id, or this key is limited to other models (Advanced on the API keys page; the message then says so). `GET /models` lists the ids your key can call."
          },
          "409": {
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "IdempotencyInProgress": {
                    "value": {
                      "error": {
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "type": "invalid_request_error",
                        "code": "idempotency_in_progress",
                        "param": null
                      }
                    },
                    "summary": "idempotency_in_progress"
                  }
                }
              }
            },
            "description": "A call with this `Idempotency-Key` is still running (`Retry-After: 2`)."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "ModelRetired": {
                    "value": {
                      "error": {
                        "message": "This model is no longer offered. Remove it from My models, or pick another one on Explore models.",
                        "type": "not_found_error",
                        "code": "model_retired",
                        "param": "model"
                      }
                    },
                    "summary": "model_retired"
                  }
                }
              }
            },
            "description": "The model is no longer offered."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "IdempotencyKeyReused": {
                    "value": {
                      "error": {
                        "message": "This Idempotency-Key was already used for a different request. Use a new key.",
                        "type": "invalid_request_error",
                        "code": "idempotency_key_reused",
                        "param": null
                      }
                    },
                    "summary": "idempotency_key_reused"
                  }
                }
              }
            },
            "description": "The `Idempotency-Key` was used for a different body."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "RateLimited": {
                    "value": {
                      "error": {
                        "message": "limit 60/min for your company on this model",
                        "type": "rate_limit_error",
                        "code": "rate_limited",
                        "param": null
                      }
                    },
                    "summary": "rate_limited"
                  },
                  "ConcurrencyLimit": {
                    "value": {
                      "error": {
                        "message": "Waited 20 s for one of this company's 8 calls at once to finish. Retry shortly.",
                        "type": "rate_limit_error",
                        "code": "concurrency_limit",
                        "param": null
                      }
                    },
                    "summary": "concurrency_limit"
                  },
                  "QuotaExceeded": {
                    "value": {
                      "error": {
                        "message": "Monthly call quota reached (10,000 calls). It resets on the 1st (UTC); ask your Kentucky AI contact to raise it.",
                        "type": "rate_limit_error",
                        "code": "quota_exceeded",
                        "param": null
                      }
                    },
                    "summary": "quota_exceeded"
                  },
                  "ProviderRateLimited": {
                    "value": {
                      "error": {
                        "message": "The model provider is busy right now. Retry shortly.",
                        "type": "rate_limit_error",
                        "code": "provider_rate_limited",
                        "param": null
                      }
                    },
                    "summary": "provider_rate_limited"
                  }
                }
              }
            },
            "description": "A rate limit, your company's calls at once or monthly quota, or the provider is busy. `Retry-After` says when to retry."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "ProviderError": {
                    "value": {
                      "error": {
                        "message": "The model provider had an error. Retry shortly.",
                        "type": "api_error",
                        "code": "provider_error",
                        "param": null
                      }
                    },
                    "summary": "provider_error"
                  },
                  "ProviderUnavailable": {
                    "value": {
                      "error": {
                        "message": "Could not reach the model provider. Retry shortly.",
                        "type": "api_error",
                        "code": "provider_unavailable",
                        "param": null
                      }
                    },
                    "summary": "provider_unavailable"
                  }
                }
              }
            },
            "description": "The provider failed or could not be reached."
          },
          "503": {
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "Unavailable": {
                    "value": {
                      "error": {
                        "message": "This model is not available right now. Try again later.",
                        "type": "api_error",
                        "code": "unavailable",
                        "param": "model"
                      }
                    },
                    "summary": "unavailable"
                  },
                  "Overloaded": {
                    "value": {
                      "error": {
                        "message": "The platform was busy for 20 s. Retry shortly.",
                        "type": "rate_limit_error",
                        "code": "overloaded",
                        "param": null
                      }
                    },
                    "summary": "overloaded"
                  }
                }
              }
            },
            "description": "The model is not available right now, or the platform is full (`Retry-After`)."
          },
          "504": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmError"
                },
                "examples": {
                  "ProviderTimeout": {
                    "value": {
                      "error": {
                        "message": "The model provider did not answer in time. Retry shortly.",
                        "type": "timeout_error",
                        "code": "provider_timeout",
                        "param": null
                      }
                    },
                    "summary": "provider_timeout"
                  }
                }
              }
            },
            "description": "The provider did not answer in time."
          }
        },
        "x-codeSamples": [
          {
            "lang": "python",
            "label": "OpenAI SDK (Python)",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://your-kentucky-ai-host/api/ka/v1\", api_key=\"ka_...\")\nreply = client.chat.completions.create(\n    model=\"claude-sonnet-5-5\",  # a slug from Explore models › LLMs, in your My models\n    messages=[{\"role\": \"user\", \"content\": \"How many doors are on sheet A101?\"}],\n    max_tokens=500,\n)\nprint(reply.choices[0].message.content)\n"
          },
          {
            "lang": "javascript",
            "label": "OpenAI SDK (JavaScript)",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://your-kentucky-ai-host/api/ka/v1\", apiKey: process.env.KENTUCKY_AI_API_KEY });\nconst stream = await client.chat.completions.create({\n  model: \"claude-sonnet-5-5\",\n  messages: [{ role: \"user\", content: \"How many doors are on sheet A101?\" }],\n  stream: true,\n});\nfor await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? \"\");\n"
          }
        ]
      }
    },
    "/messages": {
      "post": {
        "operationId": "createMessage",
        "description": "The Anthropic Messages API. Point the Anthropic SDK at `base_url = https://<host>/api/ka` (the SDK adds `/v1/messages`) with your Kentucky AI key, sent as `x-api-key` the way the SDK does (or `Authorization: Bearer`). `model` is the slug of a language model in your My models: any of them, not only Anthropic's. Same models, rules, limits and billing as `/chat/completions`.\n\n**Passed through:** `messages`, `max_tokens`, `stream`, `system`, `temperature`, `top_p`, `top_k`, `stop_sequences`, `tools`, `tool_choice`, `metadata`, `thinking`. Images as `image` blocks; a base64 PDF `document` block is sent as one image per page (the first 5).\n\n**Streaming.** `\"stream\": true` answers the Anthropic events (`message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, `message_stop`) as `text/event-stream`. A provider error mid-stream arrives as an `event: error`.\n\n**Fallbacks** work as on `/chat/completions`: the saved ones from My models, or the call's own `\"fallbacks\": [...]` (with an Anthropic SDK: `extra_body`). An answer from a fallback has `model` set to its slug and carries `X-KA-Fallback-From`.\n\n**Errors** come in the Anthropic form, `{\"type\": \"error\", \"error\": {\"type\", \"message\", \"code\"}}`, with our `code` added.",
        "summary": "Message a language model (Anthropic-compatible)",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Send the same key again (same body) to get the first answer again, free, for 24 hours; a streamed answer is replayed as the same stream. While the first call still runs, a repeat is a 409 `idempotency_in_progress`; the same key with a different body is a 422 `idempotency_key_reused`."
          },
          {
            "in": "header",
            "name": "anthropic-version",
            "schema": {
              "type": "string"
            },
            "description": "Sent by the Anthropic SDK; accepted and ignored."
          }
        ],
        "tags": [
          "Language models"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              },
              "examples": {
                "Text": {
                  "value": {
                    "model": "claude-sonnet-5-5",
                    "max_tokens": 500,
                    "messages": [
                      {
                        "role": "user",
                        "content": "How many doors?"
                      }
                    ]
                  },
                  "summary": "text"
                }
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "X-KA-Charge-USD": {
                "schema": {
                  "type": "string"
                },
                "description": "What this call was billed, in USD (a decimal string)."
              },
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present on an answer replayed for a repeated `Idempotency-Key` (billed once, with the first call)."
              },
              "X-KA-Fallback-From": {
                "schema": {
                  "type": "string"
                },
                "description": "Present when a fallback answered: the slug of the model you called, which could not answer. `model` names the one that did."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesResponse"
                },
                "examples": {
                  "Answer": {
                    "value": {
                      "id": "msg_1",
                      "type": "message",
                      "role": "assistant",
                      "model": "claude-sonnet-5-5",
                      "content": [
                        {
                          "type": "text",
                          "text": "14 doors."
                        }
                      ],
                      "usage": {
                        "input_tokens": 20,
                        "output_tokens": 4
                      }
                    },
                    "summary": "answer"
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events in the Anthropic form (`event:` and `data:` lines)."
                },
                "examples": {
                  "Stream": {
                    "value": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_1\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"claude-sonnet-5-5\",\"content\":[],\"usage\":{\"input_tokens\":20,\"output_tokens\":1}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"14 doors.\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\"},\"usage\":{\"output_tokens\":4}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
                    "summary": "stream"
                  }
                }
              }
            },
            "description": "The answer in the Anthropic form, or with `\"stream\": true` an SSE stream of Anthropic events."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "InvalidRequest": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "\"messages\" must be a non-empty list of {role, content} objects.",
                        "code": "invalid_request"
                      }
                    },
                    "summary": "invalid_request"
                  },
                  "NotALanguageModel": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "\"doors-v3\" is one of your own models: send sheets to /api/ka/v1/models/doors-v3/predict.",
                        "code": "not_a_language_model"
                      }
                    },
                    "summary": "not_a_language_model"
                  },
                  "StreamNotSupported": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "This model does not stream. Send the request without \"stream\": true.",
                        "code": "stream_not_supported"
                      }
                    },
                    "summary": "stream_not_supported"
                  },
                  "ToolsNotSupported": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "This model does not take tools / function calls.",
                        "code": "tools_not_supported"
                      }
                    },
                    "summary": "tools_not_supported"
                  },
                  "VisionNotSupported": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "This model does not take images.",
                        "code": "vision_not_supported"
                      }
                    },
                    "summary": "vision_not_supported"
                  },
                  "ContextLengthExceeded": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "prompt is too long: 203911 tokens > 200000 maximum (the provider's words)",
                        "code": "context_length_exceeded"
                      }
                    },
                    "summary": "context_length_exceeded"
                  }
                }
              }
            },
            "description": "The body is wrong, the model lacks a capability you asked for (streaming, tools, images), or the provider refused the request."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "authentication_error",
                        "message": "An API key is required: Authorization: Bearer ka_... (make one on the API keys page).",
                        "code": "unauthorized"
                      }
                    },
                    "summary": "unauthorized"
                  },
                  "InvalidApiKey": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "authentication_error",
                        "message": "Invalid or turned-off API key. Check the key, or make a new one on the API keys page.",
                        "code": "invalid_api_key"
                      }
                    },
                    "summary": "invalid_api_key"
                  }
                }
              }
            },
            "description": "No API key (`unauthorized`), or a wrong or turned-off key (`invalid_api_key`). Unlike the drawing-model addresses, a wrong key is a 401 here, as the OpenAI and Anthropic SDKs expect."
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "PaymentRequired": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "billing_error",
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time.",
                        "code": "payment_required"
                      }
                    },
                    "summary": "payment_required"
                  },
                  "SpendLimit": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "billing_error",
                        "message": "This would go over your monthly limit of $100.00: $99.80 is already used or set aside this month, and this needs up to $0.65. Raise the limit on the Billing page to go ahead. (A language-model call is checked for its largest possible cost: lower max_tokens to send a smaller one.)",
                        "code": "spend_limit"
                      }
                    },
                    "summary": "spend_limit"
                  },
                  "TeamSpendLimit": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "billing_error",
                        "message": "Monthly spending limit of team \"estimating\" reached ($200.00). A company admin can raise it.",
                        "code": "team_spend_limit"
                      }
                    },
                    "summary": "team_spend_limit"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the call's largest possible cost (its input plus `max_tokens`) would pass the company's monthly spending limit (lower `max_tokens`, or raise the limit on the Billing page). `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing was sent to the model and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "NotAdded": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "permission_error",
                        "message": "Add this model to My models first (Explore models, then Add to My models). Calls are billed to your company.",
                        "code": "not_added"
                      }
                    },
                    "summary": "not_added"
                  },
                  "OriginBlocked": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "permission_error",
                        "message": "Your company has blocked models of origin \"China\". A company admin can change this on Explore models (Language models, Origins).",
                        "code": "origin_blocked"
                      }
                    },
                    "summary": "origin_blocked"
                  }
                }
              }
            },
            "description": "The model is not in your My models, or your company blocks its origin."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "ModelNotFound": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "not_found_error",
                        "message": "The model \"claude-sonet\" does not exist. GET /api/ka/v1/models lists the ones your key can call.",
                        "code": "model_not_found"
                      }
                    },
                    "summary": "model_not_found"
                  }
                }
              }
            },
            "description": "`model_not_found`: no model has this id, or this key is limited to other models (Advanced on the API keys page; the message then says so). `GET /models` lists the ids your key can call."
          },
          "409": {
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "IdempotencyInProgress": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "api_error",
                        "message": "A request with this Idempotency-Key is still running. Retry when it has finished.",
                        "code": "idempotency_in_progress"
                      }
                    },
                    "summary": "idempotency_in_progress"
                  }
                }
              }
            },
            "description": "A call with this `Idempotency-Key` is still running (`Retry-After: 2`)."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "ModelRetired": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "not_found_error",
                        "message": "This model is no longer offered. Remove it from My models, or pick another one on Explore models.",
                        "code": "model_retired"
                      }
                    },
                    "summary": "model_retired"
                  }
                }
              }
            },
            "description": "The model is no longer offered."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "IdempotencyKeyReused": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "api_error",
                        "message": "This Idempotency-Key was already used for a different request. Use a new key.",
                        "code": "idempotency_key_reused"
                      }
                    },
                    "summary": "idempotency_key_reused"
                  }
                }
              }
            },
            "description": "The `Idempotency-Key` was used for a different body."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "RateLimited": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "rate_limit_error",
                        "message": "limit 60/min for your company on this model",
                        "code": "rate_limited"
                      }
                    },
                    "summary": "rate_limited"
                  },
                  "ConcurrencyLimit": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "rate_limit_error",
                        "message": "Waited 20 s for one of this company's 8 calls at once to finish. Retry shortly.",
                        "code": "concurrency_limit"
                      }
                    },
                    "summary": "concurrency_limit"
                  },
                  "QuotaExceeded": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "rate_limit_error",
                        "message": "Monthly call quota reached (10,000 calls). It resets on the 1st (UTC); ask your Kentucky AI contact to raise it.",
                        "code": "quota_exceeded"
                      }
                    },
                    "summary": "quota_exceeded"
                  },
                  "ProviderRateLimited": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "rate_limit_error",
                        "message": "The model provider is busy right now. Retry shortly.",
                        "code": "provider_rate_limited"
                      }
                    },
                    "summary": "provider_rate_limited"
                  }
                }
              }
            },
            "description": "A rate limit, your company's calls at once or monthly quota, or the provider is busy. `Retry-After` says when to retry."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "ProviderError": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "api_error",
                        "message": "The model provider had an error. Retry shortly.",
                        "code": "provider_error"
                      }
                    },
                    "summary": "provider_error"
                  },
                  "ProviderUnavailable": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "api_error",
                        "message": "Could not reach the model provider. Retry shortly.",
                        "code": "provider_unavailable"
                      }
                    },
                    "summary": "provider_unavailable"
                  }
                }
              }
            },
            "description": "The provider failed or could not be reached."
          },
          "503": {
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "Unavailable": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "overloaded_error",
                        "message": "This model is not available right now. Try again later.",
                        "code": "unavailable"
                      }
                    },
                    "summary": "unavailable"
                  },
                  "Overloaded": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "overloaded_error",
                        "message": "The platform was busy for 20 s. Retry shortly.",
                        "code": "overloaded"
                      }
                    },
                    "summary": "overloaded"
                  }
                }
              }
            },
            "description": "The model is not available right now, or the platform is full (`Retry-After`)."
          },
          "504": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "examples": {
                  "ProviderTimeout": {
                    "value": {
                      "type": "error",
                      "error": {
                        "type": "timeout_error",
                        "message": "The model provider did not answer in time. Retry shortly.",
                        "code": "provider_timeout"
                      }
                    },
                    "summary": "provider_timeout"
                  }
                }
              }
            },
            "description": "The provider did not answer in time."
          }
        },
        "x-codeSamples": [
          {
            "lang": "python",
            "label": "Anthropic SDK (Python)",
            "source": "import anthropic\n\nclient = anthropic.Anthropic(base_url=\"https://your-kentucky-ai-host/api/ka\", api_key=\"ka_...\")\nmessage = client.messages.create(\n    model=\"claude-sonnet-5-5\",\n    max_tokens=500,\n    messages=[{\"role\": \"user\", \"content\": \"How many doors are on sheet A101?\"}],\n)\nprint(message.content[0].text)\n"
          },
          {
            "lang": "javascript",
            "label": "Anthropic SDK (TypeScript)",
            "source": "import Anthropic from \"@anthropic-ai/sdk\";\n\nconst client = new Anthropic({ baseURL: \"https://your-kentucky-ai-host/api/ka\", apiKey: process.env.KENTUCKY_AI_API_KEY });\nconst message = await client.messages.create({\n  model: \"claude-sonnet-5-5\",\n  max_tokens: 500,\n  messages: [{ role: \"user\", content: \"How many doors are on sheet A101?\" }],\n});\nconsole.log(message.content[0].type === \"text\" ? message.content[0].text : message.content);\n"
          }
        ]
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "description": "The OpenAPI 3.1 description of this API, as JSON. No API key needed.",
        "summary": "This OpenAPI description",
        "tags": [
          "Model"
        ],
        "security": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "openapi",
                    "paths"
                  ],
                  "properties": {
                    "openapi": {
                      "type": "string"
                    },
                    "paths": {
                      "type": "object"
                    }
                  }
                }
              }
            },
            "description": "The spec."
          }
        }
      }
    },
    "/app/events": {
      "post": {
        "operationId": "postAppEvents",
        "description": "A small allowlist of anonymous product events from the OpenTakeoff app, batched: `first_launch`, `signed_in`, `project_created`, `plan_set_indexed`, `first_takeoff`, `estimate_exported`, `assistant_used`. Each is kept once per install (or, without `X-OT-Install`, per account), event and UTC day. With the app's sign-in token the account and company the token already names are kept with it; no key is needed otherwise. Only `event` and `day` are accepted: no plan content, file names or text. Unknown event names, and days more than 7 days back, are ignored and counted in `ignored`. Rows are deleted after 400 days.",
        "summary": "The OpenTakeoff app's product events",
        "parameters": [
          {
            "in": "header",
            "name": "X-OT-Install",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The app's random install id (UUID v4), as on the update check."
          }
        ],
        "tags": [
          "Tools"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "events"
                ],
                "properties": {
                  "events": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "event"
                      ],
                      "properties": {
                        "event": {
                          "type": "string",
                          "enum": [
                            "first_launch",
                            "signed_in",
                            "project_created",
                            "plan_set_indexed",
                            "first_takeoff",
                            "estimate_exported",
                            "assistant_used"
                          ]
                        },
                        "day": {
                          "type": "string",
                          "format": "date",
                          "description": "The UTC day it happened (default today; up to 7 days back)."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "security": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    },
                    "ignored": {
                      "type": "integer"
                    }
                  }
                }
              }
            },
            "description": "How many were new (`accepted`) and how many were not taken (`ignored`)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Neither an install id nor a sign-in, or a body that is not `{\"events\": [...]}` of at most 50."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Too many batches from this install. Retry after `Retry-After`."
          }
        }
      }
    },
    "/backups": {
      "get": {
        "operationId": "listBackups",
        "description": "The company's backups, newest first, and its storage: used, included and, after cancelling, when everything is deleted. Owner and admins only (with an API key, its creator must be one). Kept, for each person whose app uploads: the newest backup of each of the last 30 days that have one, and the newest of each of the last 12 months.",
        "summary": "List the backups",
        "tags": [
          "Cloud Backup"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupList"
                }
              }
            },
            "description": "The backups."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added`: add Cloud Backup to My models first. `not_admin`: only the owner and admins read backups. Or the key is unknown or turned off."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such backup for your company, or Cloud Backup is not offered."
          }
        }
      },
      "post": {
        "operationId": "createBackup",
        "description": "Any member's app starts the upload of its \"Download everything\" zip with its name, size and SHA-256, then sends the bytes in order with `PUT /backups/{id}/content`. The same file again (name, size and SHA-256) while its upload is unfinished answers `200` with that upload, so an interrupted upload resumes from `received`. At most 50 GiB a backup.\n\nBilling: $4 a company a month with 50 GB included; $1 per started 25 GB over that, on the month's peak, billed after the month. The monthly spending limit (`spend_limit`) is checked only for an upload that would go past the included storage. After cancelling, backups are read-only for 30 days (`read_only`: download only), then deleted.",
        "summary": "Start a backup upload",
        "tags": [
          "Cloud Backup"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BackupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Backup"
                }
              }
            },
            "description": "This file's unfinished upload: resume it."
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Backup"
                }
              }
            },
            "description": "Started."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`filename`, `size` or `sha256` missing or not valid."
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added` or `read_only`. Or the key is unknown or turned off."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Larger than 50 GiB."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such backup for your company, or Cloud Backup is not offered."
          }
        }
      }
    },
    "/backups/{uid}": {
      "get": {
        "operationId": "getBackup",
        "description": "One backup: how much was received (to resume) or when it completed. Owner and admins only.",
        "summary": "A backup",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The backup `id`, like `bk_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Cloud Backup"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Backup"
                }
              }
            },
            "description": "The backup."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added`: add Cloud Backup to My models first. `not_admin`: only the owner and admins read backups. Or the key is unknown or turned off."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such backup for your company, or Cloud Backup is not offered."
          }
        }
      }
    },
    "/backups/{uid}/content": {
      "put": {
        "operationId": "uploadBackupChunk",
        "description": "The raw bytes of the next chunk, with `Content-Range: bytes <start>-<end>/<size>`; `start` must be the backup's `received`. At most 64 MiB a request. The last chunk checks the SHA-256 of the whole file: `state` becomes `complete`, or `422 sha256_mismatch` and the upload is dropped.",
        "summary": "Send the next chunk",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The backup `id`, like `bk_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Cloud Backup"
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Backup"
                }
              }
            },
            "description": "Received (the backup, `state` `complete` after the last chunk)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No or a wrong `Content-Range`, or the body is not that many bytes."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`read_only` or `not_added`. Or the key is unknown or turned off."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`wrong_offset`: resume from `received`."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "More than 64 MiB in one request."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`sha256_mismatch`: the upload was dropped."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such backup for your company, or Cloud Backup is not offered."
          }
        }
      }
    },
    "/backups/{uid}/download": {
      "get": {
        "operationId": "downloadBackup",
        "description": "The zip, with `X-Sha256`. `Range: bytes=<start>-<end>` resumes a download (206). Owner and admins only; works while read-only.",
        "summary": "Download a backup",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The backup `id`, like `bk_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Cloud Backup"
        ],
        "responses": {
          "200": {
            "description": "The zip."
          },
          "206": {
            "description": "The part asked for."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added`: add Cloud Backup to My models first. `not_admin`: only the owner and admins read backups. Or the key is unknown or turned off."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such backup for your company, or Cloud Backup is not offered."
          }
        }
      }
    },
    "/documents/price-list": {
      "post": {
        "operationId": "readPriceList",
        "description": "Reads a vendor price list or quote, a scan or a photo of one, into its ruled tables and printed lines (words with their boxes and, from text recognition, their confidence), for importing a company's prices. Free for every company: no Plan Indexer, nothing billed. Multipart `file` (one PDF or image, at most 10 MB) and optional `max_pages` (at most 60).\n\nLimited per company: a number of documents a minute here, and a number of pages a day by the reader (429 with `Retry-After`). A long document answers 202 with a `status_url`; poll it until it is done.",
        "summary": "Read a price list or quote (free)",
        "tags": [
          "Plan Indexer"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "multipart/form-data": {
                  "type": "object",
                  "required": [
                    "file"
                  ],
                  "properties": {
                    "file": {
                      "type": "string",
                      "format": "binary"
                    },
                    "max_pages": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "pages": {
                      "type": "integer"
                    },
                    "text_pages": {
                      "type": "integer"
                    },
                    "ocr_pages": {
                      "type": "integer"
                    },
                    "tables": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "integer"
                          },
                          "rows": {
                            "type": "array",
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "integer"
                          },
                          "ocr": {
                            "type": "boolean"
                          },
                          "words": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": true
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "The read."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "status_url": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "description": "A long document: read as a job."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `file`, or the document could not be read."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The document is larger than 10 MB."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`rate_limited`: today's free reading for your company is used up, or too many documents this minute."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The reader could not answer right now. Retry shortly."
          }
        }
      }
    },
    "/documents/price-list/{uid}": {
      "get": {
        "operationId": "getPriceListRead",
        "description": "A long document's read: 202 while it runs, then 200 with `result` (the read). Your company's reads only.",
        "summary": "A long price list read",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The read `id` a 202 answered (32 hex characters).",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "result": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "pages": {
                          "type": "integer"
                        },
                        "text_pages": {
                          "type": "integer"
                        },
                        "ocr_pages": {
                          "type": "integer"
                        },
                        "tables": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "page": {
                                "type": "integer"
                              },
                              "rows": {
                                "type": "array",
                                "items": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "page": {
                                "type": "integer"
                              },
                              "ocr": {
                                "type": "boolean"
                              },
                              "words": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": true
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "Done."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "description": "Still reading."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The document could not be read."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such read for your company."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The reader could not answer right now. Retry shortly."
          }
        }
      }
    },
    "/indexer/jobs": {
      "post": {
        "operationId": "createIndexJob",
        "description": "Add the Plan Indexer to My models first (Explore models › Extensions, then Add), as a ready-made model; until then a new job is a 403 `not_added`. A key limited to some models calls it only when the Plan Indexer is one of them.\n\nSend PDFs (or a zip of PDFs) as multipart `files`, or a public document address as `url` (form field or JSON), with `kind`: `auto` (each PDF is sorted by its pages, and a combined bid set is split into drawings and specs), `drawings` or `specs`. Up to 50 files and 500 MB per job. Answers `202` at once with the job; poll `GET /indexer/jobs/{id}` (every 10 to 30 seconds is plenty) until `state` is `done`, then fetch `result_url`.\n\nBefore anything starts, the pages are counted and the job's largest possible cost (every page at the higher page price) is checked against your card and your monthly spending limit; a job that does not fit is a 402 and nothing runs. A `done` job is charged once: every drawing page at the drawing price plus the spec pages read natively or by OCR at the spec price. Blank and unreadable spec pages are free. A failed or cancelled job is never charged. The prices per page are on Explore models › Extensions › Plan Indexer and on the Billing page.\n\nA repeated `Idempotency-Key` with the same files (or url) and kind returns the first job with `200` and starts nothing; with different ones it is a 422.",
        "summary": "Index a drawing set or spec book",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string"
            },
            "description": "Any string you choose, unique per request (a sheet name works). A retry with the same key and body returns the first answer and is billed once; the same key with a different body is a 422. Kept 24 hours (per web process unless a shared cache is configured; billing is never doubled)."
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IndexJobUrlRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/IndexJobRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexJob"
                },
                "examples": {
                  "Queued": {
                    "value": {
                      "id": "ix_3f2a9c0b1d4e5f67",
                      "object": "index_job",
                      "state": "queued",
                      "outcome": null,
                      "kind": "auto",
                      "files": [
                        "tower-b-drawings.pdf",
                        "tower-b-specs.pdf"
                      ],
                      "input_bytes": 48211907,
                      "pages_counted": 412,
                      "max_charge_usd": "41.2000",
                      "progress": {
                        "stage": "queued"
                      },
                      "steps": {},
                      "pages": null,
                      "billed_pages": null,
                      "charge_usd": "0.000000",
                      "error": null,
                      "resubmitted": false,
                      "result_available": false,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67",
                      "result_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67/result",
                      "created_at": "2026-11-18T15:02:11.204512+00:00",
                      "started_at": null,
                      "finished_at": null,
                      "deleted": false
                    },
                    "summary": "Queued"
                  }
                }
              }
            },
            "description": "Accepted: queued. Poll `status_url`."
          },
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexJob"
                }
              }
            },
            "description": "An earlier job with the same `Idempotency-Key` and the same request. Nothing was started."
          },
          "400": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NoFiles": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "Send PDF files (or a zip of PDFs) in \"files\", or a document address in \"url\"."
                      }
                    },
                    "summary": "Nothing sent"
                  },
                  "NotAPdf": {
                    "value": {
                      "error": {
                        "code": "bad_request",
                        "message": "notes.docx: send PDF files or a zip of PDFs."
                      }
                    },
                    "summary": "Not a PDF"
                  }
                }
              }
            },
            "description": "No `files` and no `url`, or both; a file that is not a PDF or a zip of PDFs, or cannot be read (damaged or password-protected); a `kind` other than auto, drawings or specs; more than 50 files; a `url` that is not http(s) on a public host or does not answer 200."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NoKey": {
                    "value": {
                      "error": {
                        "code": "unauthorized",
                        "message": "Bearer API key with inference scope required"
                      }
                    },
                    "summary": "No key"
                  }
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "402": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NoCard": {
                    "value": {
                      "error": {
                        "code": "payment_required",
                        "message": "Add a card on the Billing page first. Usage is pay as you go: the card is charged as your usage adds up, from $25 at a time."
                      }
                    },
                    "summary": "No card on file"
                  },
                  "OverLimit": {
                    "value": {
                      "error": {
                        "code": "spend_limit",
                        "message": "This would go over your monthly limit of $100.00: $92.40 is already used or set aside this month, and this needs up to $41.20. Raise the limit on the Billing page to go ahead. (A Plan Indexer job is checked for its largest possible cost: every page at the drawing price.)"
                      }
                    },
                    "summary": "Over the monthly limit"
                  }
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through. `spend_limit`: the job's largest possible cost (every counted page at the higher page price, plus what your other running index jobs could still cost) would pass your monthly spending limit. `team_spend_limit`: it would pass the monthly spending limit of the key's team. Nothing was started or charged."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotAdded": {
                    "value": {
                      "error": {
                        "code": "not_added",
                        "message": "Add the Plan Indexer to My models first (Explore models, then Extensions, then Add). Jobs are billed to your company."
                      }
                    },
                    "summary": "Not in My models"
                  }
                }
              }
            },
            "description": "`not_added`: your company has not added the Plan Indexer to My models (Explore models › Extensions, then Add; an owner or admin can). `unauthorized`: the key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`). Nothing was started."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotAvailable": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "Not found. The Plan Indexer is not available to your company, or there is no such job."
                      }
                    },
                    "summary": "Not available"
                  }
                }
              }
            },
            "description": "No such job, or another company's (they look the same on purpose), or the Plan Indexer is not available to your company, or the key is limited to some models and the Plan Indexer is not one of them."
          },
          "413": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "TooLarge": {
                    "value": {
                      "error": {
                        "code": "too_large",
                        "message": "The files are larger than 500 MB together. Send at most 500 MB per job."
                      }
                    },
                    "summary": "Too large"
                  }
                }
              }
            },
            "description": "More than 500 MB in one job, or more pages than one job takes."
          },
          "422": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "This `Idempotency-Key` was already used for a different request. Use a new key for a new request."
          },
          "429": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model.",
                "required": true
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit.",
                "required": true
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`rate_limited`: too many new jobs this minute for your company (or this key). `quota_exceeded` / `team_quota_exceeded`: the monthly call quota of your company or of the key's team is used up. Wait `Retry-After` seconds."
          },
          "503": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The Plan Indexer cannot take jobs right now. Try again later."
          }
        },
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "curl",
            "source": "curl https://your-kentucky-ai-host/api/ka/v1/indexer/jobs \\\n  -H \"Authorization: Bearer $KA_API_KEY\" \\\n  -H \"Idempotency-Key: tower-b-bid-set\" \\\n  -F kind=auto \\\n  -F files=@drawings.pdf \\\n  -F files=@specs.pdf\n"
          },
          {
            "lang": "python",
            "label": "Python (requests)",
            "source": "import os, time, requests\n\napi = \"https://your-kentucky-ai-host/api/ka/v1\"\nauth = {\"Authorization\": f\"Bearer {os.environ['KA_API_KEY']}\"}\nwith open(\"drawings.pdf\", \"rb\") as f:\n    job = requests.post(f\"{api}/indexer/jobs\", headers=auth, data={\"kind\": \"auto\"},\n                        files=[(\"files\", (\"drawings.pdf\", f, \"application/pdf\"))]).json()\nwhile job[\"state\"] in (\"queued\", \"running\"):\n    time.sleep(15)\n    job = requests.get(job[\"status_url\"], headers=auth).json()\nif job[\"state\"] == \"done\":\n    index = requests.get(job[\"result_url\"], headers=auth).json()\n    print(job[\"charge_usd\"], len(index[\"record\"][\"entities\"]))\n"
          },
          {
            "lang": "javascript",
            "label": "JavaScript (fetch)",
            "source": "// Node 20+: KA_API_KEY=... node index.mjs\nimport { readFile } from \"node:fs/promises\";\n\nconst api = \"https://your-kentucky-ai-host/api/ka/v1\";\nconst auth = { Authorization: `Bearer ${process.env.KA_API_KEY}` };\nconst form = new FormData();\nform.append(\"kind\", \"auto\");\nform.append(\"files\", new Blob([await readFile(\"drawings.pdf\")]), \"drawings.pdf\");\nlet job = await (await fetch(`${api}/indexer/jobs`, { method: \"POST\", headers: auth, body: form })).json();\nwhile (job.state === \"queued\" || job.state === \"running\") {\n  await new Promise((r) => setTimeout(r, 15000));\n  job = await (await fetch(job.status_url, { headers: auth })).json();\n}\nif (job.state === \"done\") console.log(await (await fetch(job.result_url, { headers: auth })).json());\n"
          }
        ]
      }
    },
    "/indexer/jobs/{uid}": {
      "get": {
        "operationId": "getIndexJob",
        "description": "The job: `state`, `progress`, each step and how it went, the pages read by kind, and once `done`, the pages billed and the charge. Polling is not rate limited. A job that failed says why under `error` and was not charged.",
        "summary": "Index job status",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The index job `id`, like `ix_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "responses": {
          "200": {
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests per minute allowed by the tighter of the limits that apply to this key on this model."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "Requests left in the current minute under that limit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexJob"
                },
                "examples": {
                  "Running": {
                    "value": {
                      "id": "ix_3f2a9c0b1d4e5f67",
                      "object": "index_job",
                      "state": "running",
                      "outcome": null,
                      "kind": "auto",
                      "files": [
                        "tower-b-drawings.pdf",
                        "tower-b-specs.pdf"
                      ],
                      "input_bytes": 48211907,
                      "pages_counted": 412,
                      "max_charge_usd": "41.2000",
                      "progress": {
                        "stage": "drawings",
                        "done": 61,
                        "total": 184
                      },
                      "steps": {
                        "setup": "ok",
                        "staging": "ok"
                      },
                      "pages": null,
                      "billed_pages": null,
                      "charge_usd": "0.000000",
                      "error": null,
                      "resubmitted": false,
                      "result_available": false,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67",
                      "result_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67/result",
                      "created_at": "2026-11-18T15:02:11.204512+00:00",
                      "started_at": "2026-11-18T15:02:30.118220+00:00",
                      "finished_at": null,
                      "deleted": false
                    },
                    "summary": "Running"
                  },
                  "Done": {
                    "value": {
                      "id": "ix_3f2a9c0b1d4e5f67",
                      "object": "index_job",
                      "state": "done",
                      "outcome": "degraded",
                      "kind": "auto",
                      "files": [
                        "tower-b-drawings.pdf",
                        "tower-b-specs.pdf"
                      ],
                      "input_bytes": 48211907,
                      "pages_counted": 412,
                      "max_charge_usd": "41.2000",
                      "progress": {
                        "stage": "done"
                      },
                      "steps": {
                        "setup": "ok",
                        "staging": "ok",
                        "drawing_pages": "ok",
                        "sheet_graph": "ok",
                        "legends": "ok",
                        "sheet_titles": "ok",
                        "scale_reads": "degraded",
                        "search_index_ocr": "ok",
                        "spec:tower-b-specs.pdf": "ok",
                        "record": "ok"
                      },
                      "pages": {
                        "drawings": {
                          "native": 176,
                          "scanned": 8,
                          "total": 184
                        },
                        "specifications": {
                          "native": 214,
                          "scanned": 0,
                          "blank": 12,
                          "unresolved": 2,
                          "total": 228
                        }
                      },
                      "billed_pages": {
                        "drawings": 184,
                        "specifications": 214
                      },
                      "charge_usd": "26.960000",
                      "error": null,
                      "resubmitted": false,
                      "result_available": true,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67",
                      "result_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67/result",
                      "created_at": "2026-11-18T15:02:11.204512+00:00",
                      "started_at": "2026-11-18T15:02:30.118220+00:00",
                      "finished_at": "2026-11-18T15:41:52.903114+00:00",
                      "deleted": false
                    },
                    "summary": "Done and charged"
                  },
                  "Failed": {
                    "value": {
                      "id": "ix_3f2a9c0b1d4e5f67",
                      "object": "index_job",
                      "state": "failed",
                      "outcome": "failed",
                      "kind": "auto",
                      "files": [
                        "tower-b-drawings.pdf",
                        "tower-b-specs.pdf"
                      ],
                      "input_bytes": 48211907,
                      "pages_counted": 412,
                      "max_charge_usd": "41.2000",
                      "progress": {
                        "stage": "staging"
                      },
                      "steps": {},
                      "pages": null,
                      "billed_pages": null,
                      "charge_usd": "0.000000",
                      "error": {
                        "code": "indexing_failed",
                        "message": "The indexer could not read these files. Nothing was charged."
                      },
                      "resubmitted": false,
                      "result_available": false,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67",
                      "result_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67/result",
                      "created_at": "2026-11-18T15:02:11.204512+00:00",
                      "started_at": "2026-11-18T15:02:30.118220+00:00",
                      "finished_at": "2026-11-18T15:03:02.500000+00:00",
                      "deleted": false
                    },
                    "summary": "Failed (not charged)"
                  }
                }
              }
            },
            "description": "The job."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NotFound": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "Not found. The Plan Indexer is not available to your company, or there is no such job."
                      }
                    },
                    "summary": "Unknown job"
                  }
                }
              }
            },
            "description": "No such job, or another company's (they look the same on purpose), or the Plan Indexer is not available to your company, or the key is limited to some models and the Plan Indexer is not one of them."
          }
        }
      },
      "delete": {
        "operationId": "deleteIndexJob",
        "description": "A job that has not finished is cancelled and never charged. Its files and its result are deleted (a `done` job stays charged: its result was made). Answers the job as it is now.",
        "summary": "Cancel or delete an index job",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The index job `id`, like `ix_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexJob"
                },
                "examples": {
                  "Cancelled": {
                    "value": {
                      "id": "ix_3f2a9c0b1d4e5f67",
                      "object": "index_job",
                      "state": "cancelled",
                      "outcome": null,
                      "kind": "auto",
                      "files": [
                        "tower-b-drawings.pdf",
                        "tower-b-specs.pdf"
                      ],
                      "input_bytes": 48211907,
                      "pages_counted": 412,
                      "max_charge_usd": "41.2000",
                      "progress": {
                        "stage": "queued"
                      },
                      "steps": {},
                      "pages": null,
                      "billed_pages": null,
                      "charge_usd": "0.000000",
                      "error": {
                        "code": "cancelled",
                        "message": "The job was cancelled. Nothing was charged."
                      },
                      "resubmitted": false,
                      "result_available": false,
                      "status_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67",
                      "result_url": "https://your-kentucky-ai-host/api/ka/v1/indexer/jobs/ix_3f2a9c0b1d4e5f67/result",
                      "created_at": "2026-11-18T15:02:11.204512+00:00",
                      "started_at": null,
                      "finished_at": "2026-11-18T15:05:00.000000+00:00",
                      "deleted": true
                    },
                    "summary": "Cancelled"
                  }
                }
              }
            },
            "description": "The job, `deleted: true`."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such job, or another company's (they look the same on purpose), or the Plan Indexer is not available to your company, or the key is limited to some models and the Plan Indexer is not one of them."
          }
        }
      }
    },
    "/indexer/jobs/{uid}/query/{reader}": {
      "post": {
        "operationId": "queryIndexJob",
        "description": "A read on one page the job indexed, answered at once: `read-scale` and `parse-schedule` (from the crop image you render, `image_b64`), `ceiling-takeoff`, `framing-takeoff`, `page-text`, `page-ocr` and `vision-finishes`. The body is the reader's own, passed to the indexer unchanged, plus `sha256` (the document's, from the result's `documents`) and `page` (1-based in that document, not the job's page number).\n\nIncluded for pages already indexed and paid for: no page charge. The model calls a reader makes (`read-scale`, `parse-schedule`, `vision-finishes`) are billed to your company as normal AI usage, on the key you called with. A page the job did not index answers 402 `page_not_indexed`. The Plan Indexer must still be in My models (403 `not_added`).\n\n The job must be your company's, `done` and charged; otherwise 404 (not yours, or no such job) or 409 `result_not_ready`. A job unused for 12 months answers 410 `job_expired` with `reindex: true`: send the files again in a new job.\n\n Most reads take a few seconds; a framing takeoff on a dense sheet up to about 20, and a job not used for a day a few more while it is restored (`x-restored-ms`). Allow 120 seconds. `x-query-ms` is the indexer's own time.",
        "summary": "Read a page this job indexed (click-time)",
        "parameters": [
          {
            "in": "path",
            "name": "reader",
            "schema": {
              "type": "string",
              "enum": [
                "read-scale",
                "parse-schedule",
                "ceiling-takeoff",
                "framing-takeoff",
                "page-text",
                "page-ocr",
                "vision-finishes"
              ]
            },
            "description": "The reader.",
            "required": true
          },
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The index job `id`, like `ix_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sha256",
                  "page"
                ],
                "additionalProperties": true,
                "properties": {
                  "sha256": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "description": "The reader's answer, as the indexer gives it."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`sha256` or `page` missing, or the reader could not read this body."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`page_not_indexed`: this job did not index that page. A reader's language-model calls are billed to your company, so they are refused like any paid call: `payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added`: add the Plan Indexer to My models first. Or the key is unknown or turned off."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such job for your company, or no such reader."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`result_not_ready`: the job has not finished and been charged."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`job_expired`: unused for 12 months; `reindex: true`."
          },
          "413": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The body is larger than 25 MB."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "More than 120 queries a minute for your company. Retry after `Retry-After`."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The indexer could not answer in time. Retry shortly."
          }
        }
      }
    },
    "/indexer/jobs/{uid}/refresh": {
      "post": {
        "operationId": "refreshIndexJob",
        "description": "Send the app's corrections and the job's record (the project record, schedules and takeoff links in the result) is rebuilt from them, in place: fetch `result_url` again afterwards. Any of `schedule_review`, `corrections` and `canvas`; `null` removes one. Never billed: no page is read again and the job's pages are unchanged.\n\n The job must be your company's, `done` and charged; otherwise 404 (not yours, or no such job) or 409 `result_not_ready`. A job unused for 12 months answers 410 `job_expired` with `reindex: true`: send the files again in a new job.",
        "summary": "Rebuild a job's record from your corrections",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The index job `id`, like `ix_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "schedule_review": {
                    "type": [
                      "object",
                      "null"
                    ]
                  },
                  "corrections": {
                    "type": [
                      "object",
                      "array",
                      "null"
                    ]
                  },
                  "canvas": {
                    "type": [
                      "object",
                      "null"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "required": [
                    "id",
                    "refreshed"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "refreshed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "description": "Rebuilt: `{id, refreshed: true, at, inputs, rebuilt_parts, record_built_at, previous_built_at, record_state}`."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Not a JSON object, or a field other than the three."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such job, or another company's (they look the same on purpose), or the Plan Indexer is not available to your company, or the key is limited to some models and the Plan Indexer is not one of them."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`result_not_ready`: the job has not finished and been charged."
          },
          "410": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`job_expired`: unused for 12 months; `reindex: true`."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The indexer could not be reached. Nothing changed; retry shortly."
          }
        }
      }
    },
    "/indexer/jobs/{uid}/result": {
      "get": {
        "operationId": "getIndexResult",
        "description": "The index as one JSON document (`IndexResult`), streamed. Send `Accept-Encoding: gzip` to get it compressed (most HTTP clients do, and decompress it for you). Add `?download=1` for a file download. Kept until you delete the job.",
        "summary": "Index job result",
        "parameters": [
          {
            "in": "path",
            "name": "uid",
            "schema": {
              "type": "string"
            },
            "description": "The index job `id`, like `ix_3f2a9c0b1d4e5f67`.",
            "required": true
          }
        ],
        "tags": [
          "Plan Indexer"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexResult"
                }
              }
            },
            "description": "The index."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off or rotated away, or the Bearer value is not an API key (it does not start with `ka_`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "NoResult": {
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "This job ended without a result (see its error). Nothing was charged."
                      }
                    },
                    "summary": "Ended without a result"
                  }
                }
              }
            },
            "description": "No such job, a job that ended without a result, or a deleted one."
          },
          "409": {
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Seconds to wait before sending again.",
                "required": true
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "Running": {
                    "value": {
                      "error": {
                        "code": "result_not_ready",
                        "message": "The job is still running. Poll the job until its state is done, then fetch the result."
                      }
                    },
                    "summary": "Still running"
                  }
                }
              }
            },
            "description": "The job has not finished yet."
          }
        }
      }
    },
    "/mail-ingestion/messages": {
      "post": {
        "operationId": "recordMailMessage",
        "description": "The OpenTakeoff app reads bid invitations and plan sets that arrive by email on your computer; it calls this once for each message it processed, and the message is billed to your company at the price per message on Explore models › Extensions › Mail ingestion. The platform never receives the mail itself.\n\nAdd Mail ingestion to My models first (someone who may add paid features); until then this is a 403 `not_added`. A key limited to some models cannot call it (404).\n\nThe app may send up to 500 messages in one call as `{\"messages\": [{\"message_id\": ...}, ...]}` (what it flushes from its usage file); each is billed or answered as a duplicate exactly as if sent alone.\n\nThe same `message_id` is billed once: send its Message-ID header (or any id that stays the same on a retry). A repeat answers `200` with `duplicate: true` and the first charge, never a second one, and is never refused for money. Only a hash of the id is kept.",
        "summary": "Bill one processed email message",
        "tags": [
          "Mail ingestion"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailMessageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MailMessageRecord"
                    },
                    {
                      "$ref": "#/components/schemas/MailMessageBatchResult"
                    }
                  ]
                }
              }
            },
            "description": "This message was already billed: the first charge, `duplicate: true`. For a batch (`messages`): one result per message, in order, with `billed`, `duplicates` and `refused` counts; a refused message (`error`: `payment_required` or `spend_limit`) was not billed and can be sent again later."
          },
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailMessageRecord"
                }
              }
            },
            "description": "Billed."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`message_id` missing, empty or longer than 998 characters, or `attachments` is not a whole number from 0 to 10000."
          },
          "401": {
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Always `Bearer`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "402": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`payment_required`: no card on file, the last card charge failed, or a charge for recent usage is still going through (retry in a minute; it starts again on its own once the charge goes through). Fix or add the card on the Billing page. `spend_limit`: the company's monthly spending limit is reached; raise it on the Billing page. `team_spend_limit`: the monthly spending limit of the key's team is reached. Nothing ran and nothing was billed."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "`not_added`: add Mail ingestion to My models first. Or the key is unknown or has been turned off."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Mail ingestion is not available to your company, or the key is limited to some models."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "More than 600 messages a minute for your company. Retry after `Retry-After`."
          }
        }
      }
    },
    "/tools": {
      "get": {
        "operationId": "listTools",
        "description": "A catalogue for MCP servers and agents, generated from the platform on every call, so it follows your company's My models by itself: one tool per model (`<slug>_predict`; your own models also `<slug>_job` and `<slug>_batch`), with its description (what it finds, what one call costs), JSON Schema input and an output summary, and the built-in tools (`list_models`, `usage`, and with the Plan Indexer on, `plan_indexer_submit`, `plan_indexer_status`, `plan_indexer_result`). Every tool says the HTTP call it maps to. Only `access: \"use\"` tools are listed (any member may call them, billed to your company); `?include=add` adds the tools that add paid features.\n\nPoll cheaply: send the `version` you have as `If-None-Match` (it is the `ETag`); an unchanged catalogue answers `304` with no body. Language models are not tools: call them through `/chat/completions`.",
        "summary": "The tools your company can call",
        "parameters": [
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "type": "string"
            },
            "description": "The `version` (ETag) you have; unchanged answers 304."
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string",
              "enum": [
                "add"
              ]
            },
            "description": "`add`: also list the tools that add paid features (`access: \"add\"`)."
          }
        ],
        "tags": [
          "Tools"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolCatalogue"
                }
              }
            },
            "description": "The catalogue."
          },
          "304": {
            "description": "Unchanged since the version you sent."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off."
          }
        }
      }
    },
    "/updates/{channel}.json": {
      "get": {
        "operationId": "getUpdateManifest",
        "description": "The OpenTakeoff app's update manifest for a channel (`stable` or `beta`): exactly what the GitHub release's `latest.json` / `beta.json` serves (the Tauri updater format), cached about 5 minutes, and the last good copy when GitHub cannot be reached. No key needed.\n\nWith the header `X-OT-Install: <uuid4>` (a random id the app makes, which can be turned off in its Settings), one anonymous count a day is kept: the install id, `version`, `target`, `arch` and the channel. No IP address, account or user agent is stored; counts are deleted after 400 days. An id that is not a UUID v4 is ignored (the manifest is still served).",
        "summary": "The OpenTakeoff app's update check",
        "parameters": [
          {
            "in": "header",
            "name": "X-OT-Install",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "A random install id (UUID v4) for the anonymous daily count. Leave it out to send nothing."
          },
          {
            "in": "query",
            "name": "arch",
            "schema": {
              "type": "string"
            },
            "description": "The app's CPU arch (e.g. `x86_64`, `aarch64`)."
          },
          {
            "in": "path",
            "name": "channel",
            "schema": {
              "type": "string",
              "enum": [
                "stable",
                "beta"
              ]
            },
            "description": "The release channel.",
            "required": true
          },
          {
            "in": "query",
            "name": "target",
            "schema": {
              "type": "string"
            },
            "description": "The app's OS target (e.g. `windows`, `darwin`, `linux`)."
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "description": "The app's version."
          }
        ],
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            },
            "description": "The update manifest (Tauri format: `version`, `notes`, `pub_date`, `platforms`)."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No such channel."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "Too many checks from this install id. Retry after `Retry-After`."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No manifest yet: GitHub could not be reached and none was ever fetched."
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "description": "Calls and spend per model and in total for your company, the same numbers as the Usage page: this month (`period=month`, the default), the last 30 days (`30d`) or last month (`last_month`).",
        "summary": "Usage and spend",
        "parameters": [
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string",
              "enum": [
                "month",
                "30d",
                "last_month"
              ],
              "default": "month"
            },
            "description": "Which period the overview covers."
          }
        ],
        "tags": [
          "Tools"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageReport"
                }
              }
            },
            "description": "The usage."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "No `Authorization: Bearer ...` header, or the key has no `inference` scope."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "description": "The key is unknown or has been turned off."
          }
        }
      }
    }
  },
  "webhooks": {
    "jobFinished": {
      "post": {
        "operationId": "jobFinishedWebhook",
        "summary": "A job ended",
        "security": [],
        "tags": [
          "Jobs"
        ],
        "description": "Sent once to the job's `webhook_url` when the job ends (`succeeded` or `failed`): a POST with the job JSON, a 10 second timeout and no redirects. A failed POST (network error, timeout, 5xx, 408, 429) is retried after 10 s, 60 s and 300 s, so the same job can arrive up to 4 times: make your handler idempotent. Signed: header `X-KA-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\">` with your company's webhook secret (Settings, or GET /api/ka/webhook-secret/); recompute it over the raw body and reject a mismatch or a `t` older than 5 minutes. Any 2xx counts as delivered.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobWebhookBody"
              },
              "examples": {
                "Succeeded": {
                  "summary": "Succeeded",
                  "value": {
                    "id": "job_392852aed5ba433d",
                    "status": "succeeded",
                    "deployment": "dep-a",
                    "model_version_number": 1,
                    "status_url": "/api/ka/v1/jobs/job_392852aed5ba433d",
                    "created_at": "2026-11-16 11:37:44.536595+00:00",
                    "started_at": "2026-11-16 11:37:44.601941+00:00",
                    "completed_at": "2026-11-16 11:37:44.613438+00:00",
                    "result": {
                      "task": "instance_segmentation",
                      "shape": "outline",
                      "image_size": [
                        600,
                        400
                      ],
                      "sheet_id": null,
                      "predictions": [
                        {
                          "label": "door",
                          "confidence": 0.9231,
                          "polygon": [
                            [
                              150.0,
                              100.0
                            ],
                            [
                              210.0,
                              100.0
                            ],
                            [
                              210.0,
                              120.0
                            ],
                            [
                              150.0,
                              120.0
                            ]
                          ],
                          "bbox": [
                            150.0,
                            100.0,
                            60.0,
                            20.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        },
                        {
                          "label": "window",
                          "confidence": 0.8107,
                          "polygon": [
                            [
                              360.0,
                              200.0
                            ],
                            [
                              396.0,
                              200.0
                            ],
                            [
                              396.0,
                              224.0
                            ],
                            [
                              432.0,
                              224.0
                            ],
                            [
                              432.0,
                              248.0
                            ],
                            [
                              360.0,
                              248.0
                            ]
                          ],
                          "bbox": [
                            360.0,
                            200.0,
                            72.0,
                            48.0
                          ],
                          "page": 0,
                          "shape": "outline"
                        }
                      ],
                      "counts": {
                        "door": 1,
                        "window": 1
                      },
                      "deployment": "dep-a",
                      "model_version_number": 1,
                      "latency_ms": 5.7,
                      "usage": {
                        "requests": 1,
                        "charge_usd": "0.003000",
                        "duplicate_request": false
                      }
                    },
                    "webhook": {
                      "state": "pending"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Delivered."
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "MethodNotAllowed": {
        "description": "The URL exists but not for this method (for example GET on predict). Documented once for all paths.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "PredictWithGet": {
                "summary": "predict with GET",
                "value": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "Method \"GET\" not allowed."
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "AnthropicError": {
        "type": "object",
        "required": [
          "type",
          "error"
        ],
        "description": "The Anthropic error form (`/messages`), with our `code` added.",
        "properties": {
          "type": {
            "const": "error"
          },
          "error": {
            "type": "object",
            "required": [
              "type",
              "message",
              "code"
            ],
            "properties": {
              "type": {
                "type": "string",
                "examples": [
                  "invalid_request_error",
                  "authentication_error",
                  "billing_error",
                  "permission_error",
                  "not_found_error",
                  "rate_limit_error",
                  "overloaded_error",
                  "timeout_error",
                  "api_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string",
                "description": "The same codes as `/chat/completions`.",
                "examples": [
                  "invalid_request",
                  "not_a_language_model",
                  "stream_not_supported",
                  "tools_not_supported",
                  "vision_not_supported",
                  "context_length_exceeded",
                  "content_policy_violation",
                  "invalid_fallbacks",
                  "idempotency_key_reused",
                  "idempotency_in_progress",
                  "method_not_allowed",
                  "unauthorized",
                  "invalid_api_key",
                  "not_found",
                  "model_not_found",
                  "not_added",
                  "origin_blocked",
                  "model_retired",
                  "unavailable",
                  "payment_required",
                  "spend_limit",
                  "team_spend_limit",
                  "rate_limited",
                  "concurrency_limit",
                  "quota_exceeded",
                  "team_quota_exceeded",
                  "overloaded",
                  "provider_rate_limited",
                  "provider_error",
                  "provider_unavailable",
                  "provider_timeout"
                ]
              }
            }
          }
        }
      },
      "Backup": {
        "type": "object",
        "required": [
          "id",
          "object",
          "filename",
          "size",
          "sha256",
          "state",
          "received",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "bk_3f2a9c0b1d4e5f67"
            ]
          },
          "object": {
            "const": "backup"
          },
          "filename": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "uploading",
              "complete"
            ]
          },
          "received": {
            "type": "integer",
            "description": "Bytes received so far: the next chunk starts here."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "nightly",
              "monthly",
              null
            ],
            "description": "Why it is kept (retention)."
          },
          "chunk_size": {
            "type": "integer",
            "description": "While uploading: a good chunk size (any up to 64 MiB works)."
          },
          "upload_url": {
            "type": "string",
            "description": "While uploading: where to PUT the chunks."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "uploaded_by": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "description": "Whose app uploaded it (backups are kept per person); null when no person is on record."
          }
        }
      },
      "BackupList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "storage"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Backup"
            }
          },
          "storage": {
            "$ref": "#/components/schemas/StorageSummary"
          }
        }
      },
      "BackupRequest": {
        "type": "object",
        "required": [
          "filename",
          "size",
          "sha256"
        ],
        "additionalProperties": false,
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "size": {
            "type": "integer",
            "minimum": 1
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "Batch": {
        "type": "object",
        "required": [
          "id",
          "status",
          "counts",
          "status_url",
          "results_url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "partial",
              "failed",
              "cancelled"
            ]
          },
          "deployment": {
            "type": "string"
          },
          "model_version_number": {
            "type": "integer"
          },
          "team": {
            "type": [
              "string",
              "null"
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "queued": {
                "type": "integer"
              },
              "running": {
                "type": "integer"
              },
              "succeeded": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "cancelled": {
                "type": "integer",
                "description": "Items stopped by `cancel` before they started: never run, never billed."
              }
            }
          },
          "created_at": {
            "type": "string"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_url": {
            "type": "string"
          },
          "results_url": {
            "type": "string"
          },
          "webhook": {
            "type": "object"
          },
          "cancelled_items": {
            "type": "integer"
          }
        }
      },
      "BatchRequest": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "description": "One object per sheet, each with exactly one input. A PDF with `pages` becomes one item per page (stored once). At most 1000 items after that.",
            "items": {
              "type": "object",
              "properties": {
                "sheet_id": {
                  "type": "integer"
                },
                "image": {
                  "type": "string",
                  "description": "base64 PNG/JPEG"
                },
                "pdf": {
                  "type": "string",
                  "description": "base64 PDF"
                },
                "page": {
                  "type": "integer",
                  "minimum": 1
                },
                "pages": {
                  "oneOf": [
                    {
                      "const": "all"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1
                      }
                    }
                  ]
                },
                "url": {
                  "type": "string",
                  "description": "A public https PDF / PNG / JPEG, fetched when the item runs (30 MB max, no redirects)."
                },
                "graph": {
                  "type": "object"
                },
                "score_threshold": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              }
            }
          },
          "webhook_url": {
            "type": "string",
            "description": "https, public host. Gets the batch JSON once every item has ended, signed (X-KA-Signature)."
          },
          "score_threshold": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "auto_scale": {
            "type": "boolean"
          }
        },
        "example": {
          "items": [
            {
              "sheet_id": 12
            },
            {
              "url": "https://example.com/plans.pdf",
              "page": 3
            }
          ],
          "webhook_url": "https://example.com/hooks/ka"
        }
      },
      "ChatCompletion": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "choices"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string",
            "description": "The slug you called, or the fallback that answered (then `X-KA-Fallback-From` names the one you called)."
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "additionalProperties": true
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "description": "Tokens the provider reported; what the call is billed for. prompt_tokens_details.cached_tokens: prompt tokens read from the cache (billed at the cheaper cached price).",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ChatCompletionChunk": {
        "type": "object",
        "required": [
          "object",
          "choices"
        ],
        "additionalProperties": true,
        "description": "One `data:` event of a streamed `/chat/completions` answer.",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion.chunk"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "index": {
                  "type": "integer"
                },
                "delta": {
                  "type": "object",
                  "additionalProperties": true
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "description": "Only on the last chunk, with `stream_options.include_usage`."
          }
        }
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "additionalProperties": true,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "description": "Text, or a list of parts: {\"type\": \"text\", \"text\"}, {\"type\": \"image_url\", \"image_url\": {\"url\": \"data:image/png;base64,...\" or https URL}}, {\"type\": \"file\", \"file\": {\"file_data\": \"data:application/pdf;base64,...\"}} (a PDF is sent to the model as one image per page, the first 5).",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "ChatRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true,
        "description": "The OpenAI chat-completions body. Passed through: temperature, top_p, n, stop, presence_penalty, frequency_penalty, logit_bias, logprobs, top_logprobs, seed, response_format, tools, tool_choice, parallel_tool_calls, user, reasoning_effort, modalities, functions, function_call. Prompt caching is on: OpenAI and Gemini cache on their own; for Anthropic models a cache breakpoint is added to a long stable prefix (5 minutes) unless you set your own `cache_control`, which is passed through untouched.",
        "properties": {
          "model": {
            "type": "string",
            "description": "The address name (slug) of a language model in your My models (GET /models lists them)."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Most tokens the answer may use. Left out: 4096. Never above the model's own limit. Your monthly spending limit must fit the largest possible cost of the call."
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number"
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean"
              }
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {},
          "fallbacks": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            },
            "description": "This call's own fallbacks, in order: slugs in your My models that this key can call. Replaces the ones set on My models for this call; `[]` means none. Left out: the ones set on My models."
          }
        }
      },
      "DeploymentInfo": {
        "type": "object",
        "required": [
          "name",
          "slug",
          "status",
          "task",
          "model_version_number",
          "active_version_number",
          "available_versions",
          "classes",
          "output",
          "confidence_threshold",
          "input",
          "endpoints",
          "pin_a_version"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "task": {
            "type": "string",
            "description": "e.g. `instance_segmentation`, `semantic_segmentation`, `node_classification`, `edge_classification`."
          },
          "model_version_number": {
            "type": "integer",
            "description": "The version this answer describes: the pinned one with `?version=`, else the active one."
          },
          "active_version_number": {
            "type": "integer",
            "description": "The version that answers calls without `?version=`."
          },
          "available_versions": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "The version numbers you can pin: ready and cleared for commercial use."
          },
          "classes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The item types this model version was trained to find (never `background`, never a type that was only on validation/test sheets or had too few training examples). These are exactly the keys of `counts` in a predict answer."
          },
          "output": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "shape",
              "description"
            ],
            "description": "What each item's `polygon` is. Null for graph models.",
            "properties": {
              "shape": {
                "type": "string",
                "enum": [
                  "box",
                  "outline"
                ]
              },
              "description": {
                "type": "string"
              }
            }
          },
          "confidence_threshold": {
            "type": [
              "number",
              "null"
            ],
            "description": "The cut-off that applies when a call sends no `score_threshold`: the deployment's own, else the one the model was tested at, else 0.5 for an instance model. Null only when there is no cut-off at all (a semantic model nobody set one for): every item is returned."
          },
          "input": {
            "type": "object",
            "required": [
              "formats",
              "max_bytes",
              "max_pixels"
            ],
            "properties": {
              "formats": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "`png`, `jpeg`, `pdf` for models that find items on sheets; `graph`, `sheet_id` for graph models."
              },
              "max_bytes": {
                "type": "integer"
              },
              "max_pixels": {
                "type": "integer"
              },
              "sheet_longest_side_px": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The length a PDF page's longest side is drawn at (when the page is shorter than 2400 pt)."
              },
              "max_longest_side_px": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "training_scale": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The factor the model shrinks a sheet by before it looks at it."
              },
              "pdf_render_dpi": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "image_scaling": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "endpoints": {
            "type": "object",
            "properties": {
              "predict": {
                "type": "string"
              },
              "jobs": {
                "type": "string"
              },
              "openapi": {
                "type": "string",
                "description": "The address of this API description (OpenAPI 3.1 JSON)."
              }
            }
          },
          "pin_a_version": {
            "type": "string"
          },
          "confidence_threshold_source": {
            "type": "string",
            "enum": [
              "deployment",
              "tested",
              "default",
              "none"
            ],
            "description": "Where `confidence_threshold` comes from: this deployment's setting, the cut-off the model was tested at, the model's default (0.5), or `none` (no cut-off)."
          },
          "confidence_threshold_note": {
            "type": "string",
            "description": "The same in a sentence, e.g. \"No cut-off: every item is returned.\""
          },
          "not_trained": {
            "type": "array",
            "description": "Item types that were in the model's dataset but that this version was NOT trained on, each with the reason. Not in `classes` or `counts`.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "reason"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "description": "e.g. `only on test sheets`, `too few examples (2 of the 3 needed)`."
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "no_train",
                    "too_few",
                    "one_sheet"
                  ]
                }
              },
              "additionalProperties": true
            }
          }
        }
      },
      "EdgeResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResultMeta"
          },
          {
            "type": "object",
            "required": [
              "task",
              "edges"
            ],
            "description": "Graph model, `task: edge_classification`. Not covered by the examples here.",
            "properties": {
              "task": {
                "const": "edge_classification"
              },
              "sheet_id": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "edges": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "source",
                    "target",
                    "label",
                    "confidence"
                  ],
                  "properties": {
                    "id": {},
                    "source": {},
                    "target": {},
                    "candidate_type": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "confidence": {
                      "type": "number"
                    },
                    "probabilities": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "Every error answer has this shape. Branch on `error.code`, not on the message.",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "invalid_fallbacks",
                  "idempotency_key_reused",
                  "method_not_allowed",
                  "unauthorized",
                  "not_found",
                  "not_added",
                  "paused",
                  "model_retired",
                  "unavailable",
                  "payment_required",
                  "spend_limit",
                  "team_spend_limit",
                  "rate_limited",
                  "concurrency_limit",
                  "quota_exceeded",
                  "team_quota_exceeded",
                  "overloaded",
                  "inference_failed",
                  "inference_timeout",
                  "too_large",
                  "page_not_indexed",
                  "job_expired",
                  "result_not_ready",
                  "wrong_offset",
                  "sha256_mismatch",
                  "read_only",
                  "not_admin"
                ],
                "description": "`bad_request` 400 (also any other input the server cannot read, such as a body that is not JSON) · `unauthorized` 401 and 403 · `not_found` 404 · `method_not_allowed` 405 · `paused` 409 · `spend_limit` 402 · `idempotency_key_reused` 422 · `rate_limited` 429 · `inference_failed` 500. Ready-made models (`/models/...`) also answer `not_added` 403 (add it to My models first), `model_retired` 410 (no longer offered) and `unavailable` 503. Every call (deployments and ready-made models) can also answer `concurrency_limit` 429: your company (or team) already has as many calls running as it may; they wait their turn in a fair queue for up to 20 s first · `quota_exceeded` / `team_quota_exceeded` 429: the monthly call quota is used up (Retry-After = seconds to the 1st, UTC) · `team_spend_limit` 402 · `payment_required` 402 · `overloaded` 503: the platform is full right now · `inference_timeout` 503. Every 429 carries Retry-After, and so do `overloaded` and `inference_timeout` (503)."
              },
              "message": {
                "type": "string",
                "description": "Plain words for a person. Safe to show; never contains server internals."
              }
            }
          }
        }
      },
      "HostedModelInfo": {
        "type": "object",
        "required": [
          "name",
          "slug",
          "provider",
          "task",
          "classes",
          "price_per_call_usd",
          "endpoints"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "kentucky",
              "marketplace"
            ]
          },
          "provider_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "task": {
            "type": "string"
          },
          "classes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "model_version_number": {
            "type": "integer"
          },
          "price_per_call_usd": {
            "type": "string",
            "description": "Billed to your company for each answered call."
          },
          "rate_limit_per_minute": {
            "type": "integer",
            "description": "Calls a minute for your company on this model."
          },
          "output": {
            "type": [
              "object",
              "null"
            ]
          },
          "input": {
            "type": "object"
          },
          "endpoints": {
            "type": "object"
          }
        },
        "additionalProperties": true
      },
      "IndexJob": {
        "type": "object",
        "required": [
          "id",
          "object",
          "state",
          "kind",
          "files",
          "pages_counted",
          "max_charge_usd",
          "progress",
          "charge_usd",
          "status_url",
          "result_url",
          "result_available",
          "created_at"
        ],
        "description": "One Plan Indexer job. `state` goes `queued` → `running` → `done`, or ends `failed` or `cancelled`. A `done` job has its index at `result_url` and is charged once: every drawing page at the drawing price plus the spec pages read natively or by OCR at the spec price (blank and unreadable spec pages are free). A failed or cancelled job is never charged.",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "ix_3f2a9c0b1d4e5f67"
            ]
          },
          "object": {
            "const": "index_job"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "done",
              "failed",
              "cancelled"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "ok",
              "degraded",
              "failed",
              "timeout",
              null
            ],
            "description": "`done`: `ok`, or `degraded` when a step read only part of the set (`steps` says which). `failed`: `failed` or `timeout`."
          },
          "kind": {
            "type": "string",
            "enum": [
              "auto",
              "drawings",
              "specs"
            ]
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The file names as stored (cleaned of unsafe characters)."
          },
          "roles": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "enum": [
                "drawing",
                "specification",
                null
              ]
            },
            "description": "The roles sent with the job, by stored file name; null when none were sent."
          },
          "input_bytes": {
            "type": "integer"
          },
          "pages_counted": {
            "type": "integer",
            "description": "Pages counted in your files before the job started."
          },
          "max_charge_usd": {
            "type": "string",
            "description": "The most this job can cost: every counted page at the higher page price. Checked against your monthly limit before the start."
          },
          "progress": {
            "type": "object",
            "additionalProperties": true,
            "description": "`stage` (queued, starting, staging, drawings, scale_reads, search_index, specifications, record, export, done), and `done` / `total` when the stage reports them.",
            "properties": {
              "stage": {
                "type": "string"
              },
              "done": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "file": {
                "type": "string"
              }
            }
          },
          "steps": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Each step of the reading and how it went: `ok`, `degraded` or `failed`."
          },
          "pages": {
            "type": [
              "object",
              "null"
            ],
            "description": "The pages the indexer read, by kind (once it reports them).",
            "properties": {
              "drawings": {
                "type": "object",
                "required": [
                  "native",
                  "scanned",
                  "total"
                ],
                "properties": {
                  "native": {
                    "type": "integer",
                    "description": "Pages read from the PDF's own text and lines."
                  },
                  "scanned": {
                    "type": "integer",
                    "description": "Pages read by OCR (scans)."
                  },
                  "total": {
                    "type": "integer",
                    "description": "All drawing pages. Every one is billed at the drawing price."
                  }
                }
              },
              "specifications": {
                "type": "object",
                "required": [
                  "native",
                  "scanned",
                  "blank",
                  "unresolved",
                  "total"
                ],
                "properties": {
                  "native": {
                    "type": "integer",
                    "description": "Spec pages read from the PDF's own text. Billed."
                  },
                  "scanned": {
                    "type": "integer",
                    "description": "Spec pages read by OCR. Billed."
                  },
                  "blank": {
                    "type": "integer",
                    "description": "Blank pages. Free."
                  },
                  "unresolved": {
                    "type": "integer",
                    "description": "Pages that could not be read. Free."
                  },
                  "total": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "billed_pages": {
            "type": [
              "object",
              "null"
            ],
            "description": "The pages charged (a `done` job).",
            "properties": {
              "drawings": {
                "type": "integer"
              },
              "specifications": {
                "type": "integer"
              }
            }
          },
          "charge_usd": {
            "type": "string",
            "description": "What this job was charged, in USD. `0.000000` until it is done."
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/IndexJobError"
              },
              {
                "type": "null"
              }
            ]
          },
          "resubmitted": {
            "type": "boolean",
            "description": "The indexer restarted while the job ran, so it was sent again once, on its own."
          },
          "result_available": {
            "type": "boolean"
          },
          "status_url": {
            "type": "string",
            "format": "uri"
          },
          "result_url": {
            "type": "string",
            "format": "uri"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deleted": {
            "type": "boolean",
            "description": "Deleted with DELETE: the result is gone."
          }
        }
      },
      "IndexJobError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "description": "Why an index job ended `failed` or `cancelled`. Such a job is never charged.",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "indexing_failed",
              "indexing_timeout",
              "service_restarted",
              "service_unavailable",
              "result_lost",
              "turned_off",
              "cancelled"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "IndexJobRequest": {
        "type": "object",
        "description": "Send `files` or `url`, not both. Up to 50 files and 500 MB per job.",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "description": "PDF files, or a zip of PDFs. Repeat the field for each file."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "An http(s) address of a PDF or a zip of PDFs on a public host."
          },
          "kind": {
            "type": "string",
            "enum": [
              "auto",
              "drawings",
              "specs"
            ],
            "default": "auto",
            "description": "`auto` sorts each PDF by its pages and splits a combined bid set into drawings and specs."
          },
          "roles": {
            "type": [
              "object",
              "string"
            ],
            "additionalProperties": {
              "enum": [
                "drawing",
                "specification",
                null
              ]
            },
            "description": "Optional: what each file is, by its file name: `drawing`, `specification`, or `null` to let the indexer decide (as with `kind: auto`). A JSON object, or its JSON text in a multipart field. Passed to the indexer unchanged; a name that is not one of the files sent is a 400."
          }
        }
      },
      "IndexJobUrlRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "An http(s) address of a PDF or a zip of PDFs on a public host."
          },
          "kind": {
            "type": "string",
            "enum": [
              "auto",
              "drawings",
              "specs"
            ],
            "default": "auto",
            "description": "`auto` sorts each PDF by its pages and splits a combined bid set into drawings and specs."
          },
          "roles": {
            "type": [
              "object",
              "string"
            ],
            "additionalProperties": {
              "enum": [
                "drawing",
                "specification",
                null
              ]
            },
            "description": "Optional: what each file is, by its file name: `drawing`, `specification`, or `null` to let the indexer decide (as with `kind: auto`). A JSON object, or its JSON text in a multipart field. Passed to the indexer unchanged; a name that is not one of the files sent is a 400."
          }
        }
      },
      "IndexResult": {
        "type": "object",
        "additionalProperties": true,
        "description": "The index (`schema`: `kentucky.indexer.result.v1`), one JSON document. What each part holds:\n\n* `documents`: each file, how it was sorted (drawing or specification) and how a combined set was split.\n* `drawings`: per page the reading (`pages`), the sheet `graph` (sheets, schedules and other tables with their rows, rooms, tags,\n  callouts, notes, revisions, source links), `legends` with their entries, `sheet_index` (sheet numbers, titles, revision notes),\n  `scale_reads` (printed scales and how they checked against dimensions), `plans_info` (project data and the drawing directory)\n  and `text_coverage`.\n* `record`: the project record: entities (sheets, rooms, schedules and rows, legends, notes, details, abbreviations, codes, ...),\n  the links between them with how each was found, conflicts, and what is still unresolved, with the project facts found\n  (address, plan date, ...).\n* `specifications`: per spec book its pages, blocks, sections (number and title) and clauses with their references.\n* `search_index`: the search corpus (units of text with their sheet and place, ready for a full-text index) and the OCR words.\n* `job`: each step and how it went, the page counts, the settings it ran with.\n\nIt can be large: ask for it with `Accept-Encoding: gzip`.",
        "properties": {
          "schema": {
            "const": "kentucky.indexer.result.v1"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "drawings": {
            "type": "object"
          },
          "record": {
            "type": [
              "object",
              "null"
            ]
          },
          "specifications": {
            "type": "object"
          },
          "search_index": {
            "type": "object"
          },
          "job": {
            "type": "object"
          }
        }
      },
      "InstanceResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResultMeta"
          },
          {
            "type": "object",
            "required": [
              "task",
              "shape",
              "image_size",
              "sheet_id",
              "predictions"
            ],
            "description": "The answer of a model that finds items on a sheet (`task` is `instance_segmentation` or `semantic_segmentation`).",
            "properties": {
              "task": {
                "type": "string",
                "enum": [
                  "instance_segmentation",
                  "semantic_segmentation"
                ],
                "description": "The model family, not the output shape. `instance_segmentation`: the model finds separate items and counts them (doors, fixtures). `semantic_segmentation`: it labels areas. A model that finds boxes is still `instance_segmentation`; `shape` says whether each `polygon` is a box or an outline."
              },
              "shape": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "box",
                  "outline",
                  null
                ],
                "description": "What `polygon` is for every item. `box`: the model finds boxes only (RT-DETR, D-FINE, RF-DETR counters), `polygon` is the box's four corners and is not an outline of the item. `outline`: it follows the item. `task` is `instance_segmentation` in both cases."
              },
              "image_size": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "minItems": 2,
                "maxItems": 2,
                "description": "`[width, height]` in pixels of the image the coordinates refer to (the image you sent, or the page as drawn)."
              },
              "sheet_id": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "predictions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Item"
                }
              },
              "pdf": {
                "type": "object",
                "required": [
                  "px_per_pt",
                  "page_size_pt"
                ],
                "description": "Only for `pdf` input.",
                "properties": {
                  "px_per_pt": {
                    "type": "number",
                    "description": "Pixels per PDF point the page was drawn at: `polygon` / `px_per_pt` = `polygon_source`."
                  },
                  "page_size_pt": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "minItems": 2,
                    "maxItems": 2,
                    "description": "`[width, height]` of the page in points, as displayed."
                  }
                }
              },
              "image_scale_applied": {
                "type": "number",
                "description": "Only with `auto_scale`, when it resized the image: the factor. Coordinates are still in the pixels you sent."
              }
            }
          }
        ]
      },
      "Item": {
        "type": "object",
        "required": [
          "label",
          "confidence",
          "polygon",
          "bbox",
          "page",
          "shape"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "bbox": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 4,
            "maxItems": 4,
            "description": "`[left, top, width, height]` in the pixels of the image you sent, from the top-left corner."
          },
          "polygon": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            },
            "minItems": 3,
            "description": "Points `[x, y]` in image pixels. The four corners of the box when `shape` is `box`; the item's outline when `shape` is `outline`."
          },
          "shape": {
            "type": "string",
            "enum": [
              "box",
              "outline"
            ],
            "description": "What `polygon` is."
          },
          "page": {
            "type": "integer",
            "minimum": 0,
            "description": "The page the item is on, counting from 0. For a PDF call it is `page - 1`."
          },
          "polygon_source": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            },
            "description": "Only for `pdf` and `sheet_id` input: the same points in the drawing's own units (`source_units`). For a PDF: points (1 pt = 1/72 in) from the top-left of the page as displayed."
          },
          "source_units": {
            "type": "string",
            "description": "Unit of `polygon_source`, e.g. `pt`."
          }
        }
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "status",
          "deployment",
          "model_version_number",
          "status_url",
          "created_at",
          "started_at",
          "completed_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "job_cc4927110c1d4b07"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "deployment": {
            "type": "string"
          },
          "model_version_number": {
            "type": "integer",
            "description": "The version pinned when the job was accepted."
          },
          "status_url": {
            "type": "string",
            "format": "uri",
            "description": "A full address (`https://host/api/ka/v1/jobs/{id}`): GET it as is, do not prefix it with the host."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "result": {
            "$ref": "#/components/schemas/PredictResult",
            "description": "Only when `succeeded`. Exactly what predict returns."
          },
          "error": {
            "$ref": "#/components/schemas/JobError",
            "description": "Only when `failed`."
          },
          "webhook": {
            "type": "object",
            "required": [
              "state"
            ],
            "description": "Only when the job was submitted with a `webhook_url`.",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "pending",
                  "sending",
                  "retrying",
                  "delivered",
                  "failed"
                ]
              },
              "attempts": {
                "type": "integer",
                "description": "POSTs made so far."
              },
              "next_attempt_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the next try is due (only while `state` is `retrying`)."
              }
            }
          }
        }
      },
      "JobError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "description": "Why a job (or a batch item) ended `failed`: `paused`, `not_found`, `spend_limit`, a quota, `bad_request`, `inference_failed`, `worker_lost` (the job could not be completed after 2 tries) or `cancelled` (its batch was cancelled first).",
        "properties": {
          "code": {
            "type": "string",
            "examples": [
              "bad_request",
              "not_found",
              "paused",
              "spend_limit",
              "team_spend_limit",
              "quota_exceeded",
              "team_quota_exceeded",
              "inference_failed",
              "worker_lost",
              "cancelled"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "JobRequest": {
        "type": "object",
        "description": "Send exactly one input: `image`, `pdf` or `sheet_id` (models that classify the drawing's geometry take `graph` or `sheet_id` instead, see `input.formats` in the model info). None, or more than one, is a 400. Unknown fields are ignored; `page` is accepted only with `pdf`. Plus an optional `webhook_url`.",
        "minProperties": 1,
        "properties": {
          "image": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "A PNG or JPEG, base64 (line breaks and a `data:image/png;base64,` prefix are accepted). Used at the size you send it (see `auto_scale`). Up to 30 MB and 60 megapixels. A corrupt or truncated file is a 400."
          },
          "pdf": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "A PDF, base64 (line breaks and a `data:application/pdf;base64,` prefix are accepted), up to 30 MB. One page per call: pick it with `page`. Not combinable with `image` or `sheet_id`. A damaged or password-protected PDF, or a page that does not exist, is a 400."
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "description": "With `pdf` only (sent with `image` or `sheet_id` it is a 400): the page to read; left out, page 1. Counts from 1 (the first page is 1). In the answer, `page` on an item counts from 0 (the first page is 0)."
          },
          "sheet_id": {
            "type": "integer",
            "description": "The id of a sheet already in your Kentucky AI organization. A whole number (not a string, not true/false); a sheet that does not exist, or is not yours, is a 400 \"sheet not found\". Not combinable with `image` or `pdf`."
          },
          "score_threshold": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Return only items with at least this confidence: a number from 0 to 1 (not a string, not true/false). Default: the deployment's confidence setting, else the cut-off the model was tested at; with neither, an instance model uses 0.5 and a semantic model returns every item."
          },
          "auto_scale": {
            "type": "boolean",
            "description": "With `image`: resize it to the size its page would be as a PDF, from its dpi (none counts as 72). Off by default: scans and photos are used as sent."
          },
          "graph": {
            "type": "object",
            "description": "Graph models only: a drawing graph with `nodes` and `edges`."
          },
          "fallbacks": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            },
            "description": "This call's own fallbacks, in order: slugs in your My models that this key can call. Replaces the ones set on My models for this call; `[]` means none. Left out: the ones set on My models."
          },
          "allow_raster_inferred": {
            "type": "boolean",
            "description": "Graph models with `sheet_id` only: allow a sheet without native vectors (lines inferred from the raster)."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 500,
            "description": "https, public host, no username or password. Posted the finished job (retried after 10 s, 60 s and 300 s if it fails; see the `jobFinished` webhook)."
          }
        }
      },
      "JobWebhookBody": {
        "type": "object",
        "required": [
          "id",
          "status",
          "deployment",
          "model_version_number",
          "status_url",
          "created_at",
          "started_at",
          "completed_at"
        ],
        "description": "The job JSON posted to `webhook_url`. Same fields as `Job`: ISO 8601 timestamps, and `status_url` as a full address when the server knows its public host (set HOST), otherwise a path. `webhook.state` is `sending` at that moment. `status` is `succeeded` or `failed`.",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed"
            ]
          },
          "deployment": {
            "type": "string"
          },
          "model_version_number": {
            "type": "integer"
          },
          "status_url": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "$ref": "#/components/schemas/PredictResult"
          },
          "error": {
            "$ref": "#/components/schemas/JobError"
          },
          "webhook": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string"
              }
            }
          }
        }
      },
      "LanguageModelInfo": {
        "type": "object",
        "required": [
          "name",
          "slug",
          "kind",
          "llm",
          "endpoints"
        ],
        "description": "`GET /models/{slug}` for a language model: your prices and what it can do.",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "kind": {
            "const": "llm"
          },
          "provider_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "llm": {
            "type": "object",
            "additionalProperties": true,
            "description": "Prices are yours, in USD per 1M tokens (decimal strings).",
            "properties": {
              "input_per_mtok_usd": {
                "type": "string"
              },
              "cached_input_per_mtok_usd": {
                "type": "string"
              },
              "cache_write_per_mtok_usd": {
                "type": "string",
                "description": "Prompt tokens written to the provider's cache."
              },
              "output_per_mtok_usd": {
                "type": "string"
              },
              "min_per_request_usd": {
                "type": "string"
              },
              "long_from_tokens": {
                "type": "integer",
                "description": "A call whose prompt is longer than this many tokens is billed entirely at the `long_*` prices. 0: the model has no long-prompt tier."
              },
              "long_input_per_mtok_usd": {
                "type": "string"
              },
              "long_cached_input_per_mtok_usd": {
                "type": "string"
              },
              "long_output_per_mtok_usd": {
                "type": "string"
              },
              "context_window": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "max_output_tokens": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "streaming": {
                "type": "boolean"
              },
              "tools": {
                "type": "boolean"
              },
              "vision": {
                "type": "boolean"
              },
              "origin": {
                "type": "string"
              },
              "origin_blocked": {
                "type": "boolean"
              },
              "categories": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "base_url": {
                "type": "string"
              },
              "chat_endpoint": {
                "type": "string"
              },
              "messages_endpoint": {
                "type": "string"
              }
            }
          },
          "endpoints": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "LlmError": {
        "type": "object",
        "description": "OpenAI-style error (chat/completions, models). `/messages` answers in the Anthropic form: {\"type\": \"error\", \"error\": {\"type\", \"message\", \"code\"}}.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "type",
              "code"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "examples": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "not_found_error",
                  "rate_limit_error",
                  "insufficient_quota",
                  "api_error",
                  "timeout_error"
                ]
              },
              "code": {
                "type": "string",
                "examples": [
                  "invalid_request",
                  "not_a_language_model",
                  "stream_not_supported",
                  "tools_not_supported",
                  "vision_not_supported",
                  "context_length_exceeded",
                  "content_policy_violation",
                  "invalid_fallbacks",
                  "idempotency_key_reused",
                  "idempotency_in_progress",
                  "method_not_allowed",
                  "unauthorized",
                  "invalid_api_key",
                  "not_found",
                  "model_not_found",
                  "not_added",
                  "origin_blocked",
                  "model_retired",
                  "unavailable",
                  "payment_required",
                  "spend_limit",
                  "team_spend_limit",
                  "rate_limited",
                  "concurrency_limit",
                  "quota_exceeded",
                  "team_quota_exceeded",
                  "overloaded",
                  "provider_rate_limited",
                  "provider_error",
                  "provider_unavailable",
                  "provider_timeout"
                ]
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "LlmModelList": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "object",
                "kind"
              ],
              "additionalProperties": true,
              "properties": {
                "id": {
                  "type": "string"
                },
                "object": {
                  "const": "model"
                },
                "created": {
                  "type": "integer"
                },
                "owned_by": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "description": "yours | kentucky | marketplace | llm | extension"
                },
                "name": {
                  "type": "string"
                },
                "endpoint": {
                  "type": "string"
                },
                "context_window": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "max_output_tokens": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "origin": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "categories": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "capabilities": {
                  "type": "object",
                  "properties": {
                    "streaming": {
                      "type": "boolean"
                    },
                    "tools": {
                      "type": "boolean"
                    },
                    "vision": {
                      "type": "boolean"
                    }
                  }
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "own",
                    "hosted",
                    "extension",
                    "alias"
                  ],
                  "description": "`alias`: a platform model id such as `kentucky-vision`, mapped to the model the platform picks."
                },
                "alias": {
                  "type": "boolean",
                  "description": "A platform alias (callable without adding a model)."
                },
                "available": {
                  "type": "boolean",
                  "description": "Ready-made models only: false when the model is in My models but cannot be called right now (its service is not configured or is down); its info and predict answer 503 `unavailable`, and `/v1/tools` leaves it out until it is back."
                },
                "unavailable_reason": {
                  "type": "string",
                  "description": "Why `available` is false."
                },
                "price_per_message_usd": {
                  "type": "string",
                  "description": "Mail ingestion: your price per processed message."
                },
                "price_month_usd": {
                  "type": "string",
                  "description": "Cloud Backup: your price a month."
                },
                "storage": {
                  "$ref": "#/components/schemas/StorageSummary"
                },
                "seats": {
                  "type": "integer",
                  "description": "Teams: the seats your company pays for."
                },
                "seat_price_usd": {
                  "type": "string",
                  "description": "Teams: your price per seat a month."
                },
                "company_id": {
                  "type": "string",
                  "description": "Teams: your company, as the Teams relay knows it."
                },
                "page_prices": {
                  "type": "object",
                  "description": "An extension billed per page: your price in USD.",
                  "properties": {
                    "drawing_page_usd": {
                      "type": "string"
                    },
                    "spec_page_usd": {
                      "type": "string"
                    }
                  }
                },
                "pricing": {
                  "type": "object",
                  "description": "Your price in USD per 1M tokens.",
                  "properties": {
                    "input_per_mtok_usd": {
                      "type": "string"
                    },
                    "cached_input_per_mtok_usd": {
                      "type": "string"
                    },
                    "output_per_mtok_usd": {
                      "type": "string"
                    },
                    "min_per_request_usd": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "MailMessageBatchResult": {
        "type": "object",
        "required": [
          "object",
          "data",
          "billed",
          "duplicates",
          "refused"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "billed": {
            "type": "integer"
          },
          "duplicates": {
            "type": "integer"
          },
          "refused": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MailMessageRecord"
                }
              ],
              "properties": {
                "error": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "MailMessageRecord": {
        "type": "object",
        "required": [
          "object",
          "id",
          "duplicate",
          "charge_usd",
          "recorded_at"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "mail_ingestion.message"
            ]
          },
          "id": {
            "type": "string",
            "description": "A hash of the message id (the id itself is not kept)."
          },
          "duplicate": {
            "type": "boolean",
            "description": "True when this message was already billed: the charge is the first one."
          },
          "charge_usd": {
            "type": "string",
            "description": "What this message was billed, in US dollars."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MailMessageRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "One message (`message_id`, `attachments`), or up to 500 as `messages`.",
        "properties": {
          "message_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 998,
            "description": "The message's Message-ID header, or any id that is the same on every retry of this message."
          },
          "attachments": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "default": 0,
            "description": "How many attachments the app read (shown on the invoice line; the price is per message)."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "description": "A batch: each item `{message_id, attachments?}`.",
            "items": {
              "type": "object",
              "required": [
                "message_id"
              ],
              "properties": {
                "message_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 998
                },
                "attachments": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                }
              }
            }
          }
        }
      },
      "MessagesRequest": {
        "type": "object",
        "required": [
          "model",
          "messages",
          "max_tokens"
        ],
        "additionalProperties": true,
        "description": "The Anthropic Messages body. Passed through: system, temperature, top_p, top_k, stop_sequences, tools, tool_choice, metadata, thinking. Images as {\"type\": \"image\", \"source\": {...}}; a base64 PDF {\"type\": \"document\"} is sent as page images.",
        "properties": {
          "model": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "system": {},
          "stream": {
            "type": "boolean"
          },
          "fallbacks": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            },
            "description": "This call's own fallbacks, in order: slugs in your My models that this key can call. Replaces the ones set on My models for this call; `[]` means none. Left out: the ones set on My models."
          }
        }
      },
      "MessagesResponse": {
        "type": "object",
        "required": [
          "type",
          "content"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "message"
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "cache_read_input_tokens": {
                "type": "integer"
              },
              "cache_creation_input_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "NodeResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResultMeta"
          },
          {
            "type": "object",
            "required": [
              "task",
              "nodes"
            ],
            "description": "Graph model, `task: node_classification`. Not covered by the examples here.",
            "properties": {
              "task": {
                "const": "node_classification"
              },
              "sheet_id": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "nodes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "label",
                    "confidence"
                  ],
                  "properties": {
                    "id": {},
                    "label": {
                      "type": "string"
                    },
                    "confidence": {
                      "type": "number"
                    },
                    "probabilities": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    },
                    "primitive_ids": {
                      "type": "array",
                      "items": {}
                    },
                    "bbox": {}
                  }
                }
              }
            }
          }
        ]
      },
      "PredictRequest": {
        "type": "object",
        "description": "Send exactly one input: `image`, `pdf` or `sheet_id` (models that classify the drawing's geometry take `graph` or `sheet_id` instead, see `input.formats` in the model info). None, or more than one, is a 400. Unknown fields are ignored; `page` is accepted only with `pdf`.",
        "minProperties": 1,
        "properties": {
          "image": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "A PNG or JPEG, base64 (line breaks and a `data:image/png;base64,` prefix are accepted). Used at the size you send it (see `auto_scale`). Up to 30 MB and 60 megapixels. A corrupt or truncated file is a 400."
          },
          "pdf": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "A PDF, base64 (line breaks and a `data:application/pdf;base64,` prefix are accepted), up to 30 MB. One page per call: pick it with `page`. Not combinable with `image` or `sheet_id`. A damaged or password-protected PDF, or a page that does not exist, is a 400."
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "description": "With `pdf` only (sent with `image` or `sheet_id` it is a 400): the page to read; left out, page 1. Counts from 1 (the first page is 1). In the answer, `page` on an item counts from 0 (the first page is 0)."
          },
          "sheet_id": {
            "type": "integer",
            "description": "The id of a sheet already in your Kentucky AI organization. A whole number (not a string, not true/false); a sheet that does not exist, or is not yours, is a 400 \"sheet not found\". Not combinable with `image` or `pdf`."
          },
          "score_threshold": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Return only items with at least this confidence: a number from 0 to 1 (not a string, not true/false). Default: the deployment's confidence setting, else the cut-off the model was tested at; with neither, an instance model uses 0.5 and a semantic model returns every item."
          },
          "auto_scale": {
            "type": "boolean",
            "description": "With `image`: resize it to the size its page would be as a PDF, from its dpi (none counts as 72). Off by default: scans and photos are used as sent."
          },
          "graph": {
            "type": "object",
            "description": "Graph models only: a drawing graph with `nodes` and `edges`."
          },
          "fallbacks": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string"
            },
            "description": "This call's own fallbacks, in order: slugs in your My models that this key can call. Replaces the ones set on My models for this call; `[]` means none. Left out: the ones set on My models."
          },
          "allow_raster_inferred": {
            "type": "boolean",
            "description": "Graph models with `sheet_id` only: allow a sheet without native vectors (lines inferred from the raster)."
          }
        }
      },
      "PredictResult": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/InstanceResult"
          },
          {
            "$ref": "#/components/schemas/NodeResult"
          },
          {
            "$ref": "#/components/schemas/EdgeResult"
          }
        ],
        "description": "What `predict` answers, and what a succeeded job carries under `result`."
      },
      "ResultMeta": {
        "type": "object",
        "required": [
          "counts",
          "deployment",
          "model_version_number",
          "latency_ms",
          "usage"
        ],
        "properties": {
          "counts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            },
            "description": "`counts` lists every item type this model was trained to find, with a 0 for each one that was not found. A type that was only in the dataset's validation or test sheets, or had too few training examples, is not trained and is not listed (the model info and the model card name those under `not_trained`). Versions trained before this rule are served with the types that had at least one training example in their own dataset version. Empty for graph models."
          },
          "deployment": {
            "type": "string",
            "description": "The deployment slug."
          },
          "model_version_number": {
            "type": "integer",
            "description": "The version that ran."
          },
          "latency_ms": {
            "type": "number"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "record_id": {
            "type": "string",
            "description": "Only when the deployment keeps predictions for review and the call used `sheet_id`."
          },
          "review_url": {
            "type": "string",
            "description": "Relative address of the review page for `record_id`."
          },
          "model": {
            "type": "string",
            "description": "Ready-made models, and any answer from a fallback: the slug of the model that answered."
          }
        }
      },
      "StorageSummary": {
        "type": "object",
        "required": [
          "state",
          "used_bytes",
          "deletes_at"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "active",
              "read_only",
              "deleted",
              "off"
            ],
            "description": "`read_only`: cancelled; download only until `deletes_at` (30 days), then everything is deleted."
          },
          "used_bytes": {
            "type": "integer"
          },
          "included_bytes": {
            "type": "integer",
            "description": "Cloud Backup: included in the monthly fee (50 GB)."
          },
          "quota_bytes": {
            "type": "integer",
            "description": "Teams: included, 25 GB per paid seat, pooled."
          },
          "deletes_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Tool": {
        "type": "object",
        "required": [
          "name",
          "title",
          "description",
          "access",
          "source",
          "http",
          "input_schema",
          "output"
        ],
        "description": "One callable tool. Call it by sending `input_schema`-shaped arguments to `http.path` with `http.method`: path parameters (`http.path_params`) go into the path, the rest as the JSON body (`body: \"json\"`), as query parameters (`\"query\"`), or nothing (`\"none\"`).",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$",
            "description": "Stable, from the model slug: `<slug>_predict`, `<slug>_job`, `<slug>_batch`, or a built-in name."
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "What it does, what it finds, what one call costs."
          },
          "access": {
            "type": "string",
            "enum": [
              "use",
              "add"
            ],
            "description": "`use`: any member may call it, billed to the company. `add`: it adds a paid feature and needs the permission to add paid features."
          },
          "source": {
            "type": "string",
            "enum": [
              "own",
              "hosted",
              "builtin"
            ]
          },
          "http": {
            "type": "object",
            "required": [
              "method",
              "path",
              "path_params",
              "body"
            ],
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "GET",
                  "POST"
                ]
              },
              "path": {
                "type": "string"
              },
              "path_params": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "body": {
                "type": "string",
                "enum": [
                  "json",
                  "query",
                  "none"
                ]
              }
            }
          },
          "input_schema": {
            "type": "object",
            "description": "JSON Schema (2020-12) of the arguments."
          },
          "output": {
            "type": "object",
            "required": [
              "summary"
            ],
            "properties": {
              "summary": {
                "type": "string"
              },
              "schema": {
                "type": "string",
                "description": "The answer's schema in this document."
              },
              "shape": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "classes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "slug": {
            "type": "string",
            "description": "Model tools only: the slug of the model it calls (the same as `model.slug`)."
          },
          "in_my_models": {
            "type": "boolean",
            "description": "Model tools only: always true (the model is in your company's My models)."
          },
          "model": {
            "type": "object",
            "description": "Model tools only: the model behind it.",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "task": {
                "type": "string"
              },
              "page_url": {
                "type": "string"
              },
              "price_per_call_usd": {
                "type": "string"
              },
              "provider_name": {
                "type": "string"
              }
            }
          }
        }
      },
      "ToolCatalogue": {
        "type": "object",
        "required": [
          "schema",
          "version",
          "company_id",
          "tools"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "const": "kentucky.tools.v1"
          },
          "version": {
            "type": "string",
            "description": "A hash of the catalogue, also the `ETag`. It changes whenever any tool changes: a model added or removed, an extension turned on or off, new classes, a new price."
          },
          "company_id": {
            "type": "string"
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          }
        }
      },
      "Usage": {
        "type": "object",
        "required": [
          "requests",
          "charge_usd",
          "duplicate_request"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "const": 1
          },
          "charge_usd": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "This call's charge as a decimal string. On a duplicate (`duplicate_request: true`) it shows the original call's charge, not `\"0.000000\"`: nothing was billed again. Examples show a sample, not your price."
          },
          "duplicate_request": {
            "type": "boolean",
            "description": "True when this is the answer to an earlier call with the same Idempotency-Key. Nothing ran and nothing was billed again."
          },
          "fallback": {
            "type": "object",
            "required": [
              "from",
              "reason"
            ],
            "description": "Only when a fallback answered (see Fallbacks): the model you called and why it did not answer. `model` names the one that did, and the charge is its price.",
            "properties": {
              "from": {
                "type": "string",
                "description": "The slug you called."
              },
              "reason": {
                "type": "string",
                "description": "Its error code, such as `inference_timeout` or `paused`."
              }
            }
          }
        }
      },
      "UsageReport": {
        "type": "object",
        "additionalProperties": true,
        "description": "Calls and spend for your company, the numbers on the Usage page.",
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "month_start": {
            "type": "string",
            "format": "date"
          },
          "spend_month_usd": {
            "type": "string"
          },
          "warm_spend_month_usd": {
            "type": "string"
          },
          "warm_hours_month": {
            "type": "number"
          },
          "plan_indexer": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "overview": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same key as `x-api-key: ka_...`, the way the Anthropic SDK sends it (`/messages` only)."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ka_...",
        "description": "An organization API key with the `inference` scope: `Authorization: Bearer ka_...`."
      }
    }
  }
}
