{"openapi":"3.1.0","info":{"title":"Sage 2","version":"2.0.0"},"paths":{"/ready":{"get":{"summary":"Ready","operationId":"ready_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/models":{"get":{"summary":"Models","description":"OpenRouter List Models — unauthenticated catalog of available models.","operationId":"models_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Models Models Get"}}}}}}},"/decide":{"post":{"summary":"Decide","operationId":"decide_decide_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideRequestPublic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/YesNoDecideResponsePublic"},{"$ref":"#/components/schemas/ChoiceDecideResponsePublic"},{"$ref":"#/components/schemas/ScaleDecideResponsePublic"},{"$ref":"#/components/schemas/SortDecideResponsePublic"},{"$ref":"#/components/schemas/TagsDecideResponsePublic"}],"title":"Response Decide Decide Post","discriminator":{"propertyName":"kind","mapping":{"yesno":"#/components/schemas/YesNoDecideResponsePublic","choice":"#/components/schemas/ChoiceDecideResponsePublic","scale":"#/components/schemas/ScaleDecideResponsePublic","sort":"#/components/schemas/SortDecideResponsePublic","tags":"#/components/schemas/TagsDecideResponsePublic"}}}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/decide/batch":{"post":{"summary":"Decide Batch","operationId":"decide_batch_decide_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDecideRequestPublic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDecideResponsePublic"}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/models":{"get":{"tags":["systemone"],"summary":"Systemone Models","description":"List the model names `POST /v1/systemone` accepts (the Sage model and its aliases).","operationId":"systemone_models_v1_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelMetadataList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/systemone":{"post":{"tags":["systemone"],"summary":"Systemone Decide","description":"TypeSafe-compatible request: `{state, model, questions: {name: {type, instructions, criteria}}}` ->\n`{model, answers: {name: ...}, usage}`. Every question is one `/decide/batch` question on the state, so the\nanswers are exactly what `/decide` gives for the equivalent Sage question; reasoning is off unless the body\ncarries `reasoning: auto|on` (same field as /decide). Provider options (`provider.options.levanto` /\n`provider.options[\"near-ai\"]`, or the same keys at the top level): `reasoning`, `latency_mode`,\n`grounding` (one config, or per question), `tags` (noul questions read as one tag set) and `sort`\n(sorts a list in the state). 422 (TypeSafe's shape) on an unknown model, an unrepresentable question or a\nmalformed option.","operationId":"systemone_decide_v1_systemone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemOneRequest"},"examples":{"decisions":{"summary":"noul, choice and score questions","value":{"model":"sage-latest","state":{"subject":"Duplicate charge","message":"I was charged twice."},"questions":{"billing":{"type":"noul","instructions":"Is this about billing?"},"tone":{"type":"choice","instructions":"Tone?","criteria":{"angry":"upset","calm":null}},"urgency":{"type":"score","criteria":["can wait","this week","today"]}}}},"provider_options":{"summary":"Provider options: grounding per question and a tag set","value":{"model":"sage-latest","state":{"subject":"Duplicate charge","message":"Charged twice. Click here to win a prize!"},"questions":{"is_billing":{"type":"noul","instructions":"Is this about billing?"},"spam":{"type":"noul","instructions":"Is this spam?"},"scam":{"type":"noul","instructions":"Is this a scam?"}},"provider":{"options":{"near-ai":{"reasoning":"auto","grounding":{"is_billing":{"trigger":"always","max_results":3}},"tags":{"moderate":{"questions":["spam","scam"],"instructions":"Moderation"}}}}}}},"sort":{"summary":"Sort a list from the state","value":{"model":"sage-latest","state":{"tickets":{"t1":"Password reset","t2":"Site down for everyone","t3":"Typo on pricing page"}},"questions":{"outage":{"type":"noul","instructions":"Is anything down?"}},"provider":{"options":{"levanto":{"sort":{"priority":{"items":"tickets","instructions":"Most urgent first"}}}}}}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemOneResponse"}}}},"422":{"description":"Validation Error"}},"security":[{"HTTPBearer":[]}]}},"/v1/extract":{"post":{"tags":["extract"],"summary":"Extract typed values from a document","description":"Send a document and say what to find; get typed values back, with where each was found and how likely it is.\n\n**The shape of the request is the shape of the answer.** `extract` is one of:\n\n- an object `{name: spec}`, one entry per field, where the spec is\n  - a definition string, or `\"\"` / `null` when the name says it all: one text value;\n  - `{\"type\": ..., \"definition\": ...}` (both optional): one typed value;\n  - a list holding one of those, such as `[\"A named person who signs.\"]` or `[{\"type\": \"money\"}]`: every mention.\n\n  A name may be a question (\"What's the amount of the invoice?\").\n- a question string: one answer;\n- a list holding one question string, such as `[\"Who signed?\"]`: every answer.\n\n**Types:** `text` (the default), `integer`, `decimal`, `money`, `date`, `time`, `datetime`, `duration` (see the FieldType schema). Values are read only from what the text states.\n\n**Response.** `values` is the request filled in: every field in request order, `null` when it is absent or undecided, a list for every-mention fields. `results` has the same keys:\n\n- one value: `value`, `text`, `start`, `end`, `probability` and `probabilities`, which lists every candidate and then `{\"value\": null}` (not in the document), summing to 1. Not in the document: `value` is null and `probability` is the probability of absence. Undecided (the two best options are too close to call): `value` and `probability` are null.\n- every mention: `values`, a list of `{value, text, start, end, probability}` in document order (`[]` when there is none).\n\nFor a bare question, `values` is the answer and `results` is its one result.\n\n**Offsets** are Unicode code points into `content` (`start` inclusive, `end` exclusive), and `text` is `content[start:end]` verbatim.\n\n**Mode.** `fast` (the default and only mode): one forward pass, no generation.\n\n**Usage** (`meta.usage`). `input_tokens`: the prompt Sage reads for each document: your content, the field names and definitions, and its instructions. `output_tokens`: the size of this response body as sent, in tokens.\n\n**Limits.** At most 64 fields. Names and questions: up to 256 characters, no double quotes or line breaks, unique ignoring case (`_` counts as a space). Definitions: up to 4,000 characters. The document plus the field names and definitions may be at most 16,384 tokens; a longer request is a 413: split the document and send the parts as `/v1/extract/batch` `contents`.","operationId":"extract_route_v1_extract_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"},"examples":{"invoice":{"summary":"Typed fields from a German invoice","value":{"content":"RECHNUNG Nr. 2026-1147\nMüller & Söhne Maschinenbau GmbH · Königstraße 21 · 70173 Stuttgart\nRechnungsempfänger: Bäckerei Schröder KG, Hauptstraße 5, 80331 München\nRechnungsdatum: 14.10.2026\nNettobetrag 1.622,50 € · zzgl. 19 % USt 308,28 € · Gesamtbetrag 1.930,78 €\nZahlbar bis 28.10.2026.","extract":{"seller":"The company issuing the invoice.","buyer":"","invoice number":"","invoice date":{"type":"date"},"total":{"type":"money","definition":"The final amount due including tax."},"tax rate":{"type":"decimal","definition":"The VAT rate in percent."},"due date":{"type":"date","definition":"The date by which the invoice must be paid."}},"mode":"fast"}},"question":{"summary":"One answer to a bare question","value":{"content":"Total due: 1.930,78 € incl. 19 % USt, payable by 28.10.2026.","extract":"What's the amount of the invoice?"}},"every_mention":{"summary":"Every mention of each field","value":{"content":"This Lease is entered into on 2 May 2026 between Beacon Realty Holdings LLC and Acme Robotics Inc. Signed: Maria Delgado (Beacon Realty Holdings LLC) and Kenji Watanabe (Acme Robotics Inc.).","extract":{"party":["A company that signs the agreement or is bound by it."],"signatory":["A named person who signs on behalf of a party."],"date":[{"type":"date"}]}}}}}},"required":true},"responses":{"200":{"description":"The request filled in.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"400":{"description":"Invalid request: `detail` says what is wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}},"413":{"description":"The document and field definitions are over 16,384 tokens: split the content."},"429":{"description":"Overloaded: retry after the number of seconds in the `Retry-After` header."},"503":{"description":"Temporarily unavailable, or extraction is not available on this deployment."}},"security":[{"HTTPBearer":[]}]}},"/api/alpha/extractions":{"post":{"tags":["extractions"],"summary":"Extract typed fields (OpenRouter Extractions shape)","description":"OpenRouter's Extractions request and answer shape (`POST /api/alpha/extractions`), so a client written against OpenRouter changes only the base URL. Same engine as `/v1/extract`.\n\n**Request.** `model`, `state` (the text), `fields` `{name: {type, instructions?, null_threshold?, ...}}`, `reference_date` (`YYYY-MM-DD`: the year of a date written without one, the nearest such date). Types: `text`, `number` (`integer`, `decimals`, `unit`: a currency such as `USD` reads the amount in that currency, any other unit is a label), `date`, `time`, `datetime`, `duration` (`unit`: seconds to years; `integer`, `decimals`), `list` (`items`: any of those types). `estimate`, `forecast` and `assets` are not supported (400). Unknown keys are a 400. Options under `provider.options.levanto` (or `near-ai`): `return_state_text`, `candidates`.\n\n**Answers.** `value` (null when `p_null` is above the field's `null_threshold`, default 0.5), `guess` (the most likely value either way), `p_null`, and for a value: `confidence`, `span` (`[start, end)` in Unicode code points into `state`) and `text` (the text it was read from). A number read as money also carries `currency`; a converted duration carries `unit`. Lists: `value`, `spans`, `confidences`, `texts`. `candidates: true` adds every candidate with its span and probability.\n\n**Limits.** 64 fields per pass (more fields are read in more passes, `usage.passes`); the state plus one pass's field definitions may be at most 16,384 tokens (413).\n\n**Billing.** Input: the prompt Sage reads in every pass. Output: the size of this response body, in tokens.","operationId":"extractions_route_api_alpha_extractions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsRequest"},"examples":{"invoice":{"summary":"OpenRouter's invoice example (without the estimate field)","value":{"model":"sage-latest","reference_date":"2026-10-28","state":"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.","fields":{"invoice_number":{"type":"text"},"due_date":{"type":"date","instructions":"Issue date plus the net payment days"},"total":{"type":"number","decimals":2,"unit":"USD"},"contacts":{"type":"list","items":"text"}}}},"lease":{"summary":"Durations in a unit, a threshold, options","value":{"model":"sage-latest","state":"Acme Corp. signed a three (3) year lease with Beacon Realty on 2 May 2026. Notice: 90 days.","fields":{"term_months":{"type":"duration","unit":"months","integer":true},"notice":{"type":"duration","unit":"days"},"signed":{"type":"date","null_threshold":0.3},"parties":{"type":"list","items":"text","instructions":"Companies that sign"}},"provider":{"options":{"levanto":{"return_state_text":true,"candidates":true}}}}}}}},"required":true},"responses":{"200":{"description":"One answer per field, keyed by the field name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsResponse"}}}},"400":{"description":"Invalid request: `{\"error\": {\"code\": 400, \"message\": ...}}`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsErrorBody"}}}},"413":{"description":"The state and field definitions are over 16,384 tokens per pass.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsErrorBody"}}}},"429":{"description":"Overloaded: retry after the number of seconds in the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsErrorBody"}}}},"503":{"description":"Temporarily unavailable, or extraction is not available on this deployment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsErrorBody"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/extract/batch":{"post":{"tags":["extract"],"summary":"Extract the same fields from several documents","description":"`POST /v1/extract` for several documents: `contents` (at most 64) and one `extract` for all of them, answered in order. Each item of `results` is `{\"ok\": true, \"values\", \"results\"}` as in `/v1/extract`, or `{\"ok\": false, \"error\"}` when that document failed (for example, it is longer than 16,384 tokens with the field definitions); the prompt of a failed document is not billed. `mode: fast` on a deployment without fast extraction is a 503 for the whole request.\n\n**Usage** (`meta.usage`). `input_tokens`: the prompt Sage reads for each document: your content, the field names and definitions, and its instructions. `output_tokens`: the size of this response body as sent, in tokens.","operationId":"extract_batch_route_v1_extract_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractBatchRequest"},"examples":{"invoices":{"summary":"The same fields from several documents","value":{"contents":["Invoice 2026-1147 from Müller & Söhne GmbH. Total due: 1.930,78 €.","Invoice INV-88 from Beacon Realty Holdings LLC. Amount due: $48,500.00."],"extract":{"seller":"The company issuing the invoice.","total":{"type":"money"}}}}}}},"required":true},"responses":{"200":{"description":"One item per document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractBatchResponse"}}}},"400":{"description":"Invalid request: `detail` says what is wrong.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}},"429":{"description":"Overloaded: retry after the number of seconds in the `Retry-After` header."},"503":{"description":"Temporarily unavailable, or extraction is not available on this deployment."}},"security":[{"HTTPBearer":[]}]}},"/usage/estimate":{"post":{"summary":"Usage Estimate","description":"Predicts input_tokens and output_tokens for a request body without running it.\n\nSend the same JSON body you would send to /decide or /decide/batch.","operationId":"usage_estimate_usage_estimate_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Body"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/stream":{"get":{"tags":["stream"],"summary":"Stream decisions over a growing document (WebSocket)","description":"Live decisions over a document that grows: open a WebSocket, send the questions once, append text as it arrives, and receive a decision frame whenever an answer changes. Connect to `wss://<host>/v1/stream`; this entry documents the upgrade request (`GET` with `Upgrade: websocket`), answered with `101 Switching Protocols`. Every frame is a JSON text frame.\n\n**Auth.** `Authorization: Bearer <API key>` on the upgrade request, or `api_key` in the `start` frame when the client cannot set headers (browsers).\n\n**Client frames**\n\n- `{\"type\": \"start\", \"questions\": [...], \"content\": \"\", \"reasoning\": \"off\", \"emit\": \"changes\"}`: the first frame. `questions`: 1 to 32 question objects as in `POST /decide/batch`, each with an `id`. `content`: the document so far (optional). `reasoning`: `off` (default), `auto` or `on`. `emit`: `changes` (default) sends a decision only when an answer changed, plus the first one; `all` sends every evaluation.\n- `{\"type\": \"append\", \"text\": \"...\", \"seq\": 7}`: add text to the end of the document. `seq` is optional; the decision that includes the text echoes it.\n- `{\"type\": \"questions\", \"questions\": [...]}`: replace the question set; the next decision is sent in full.\n- `{\"type\": \"evaluate\"}`: evaluate now, without new text.\n- `{\"type\": \"ping\"}`: answered with `{\"type\": \"pong\"}`.\n- `{\"type\": \"close\"}`: end the session.\n\nText can only be appended; to change earlier text, open a new session. Appends that arrive while an evaluation runs are merged into the next evaluation.\n\n**Server frames**\n\n- `{\"type\": \"ready\", \"session\": \"...\", \"limits\": {\"max_chars\", \"idle_s\", \"max_questions\", \"max_prompt_tokens\"}}`: the session is open.\n- `{\"type\": \"decision\", \"seq\": 7, \"chars\": 1234, \"latency_ms\": 80.5, \"eval_ms\": 95.2, \"answers\": {\"<id>\": {...}}, \"changed\": [\"<id>\"], \"usage\": {...}}`: `answers` holds each question's `result` as `POST /decide/batch` returns it (`{\"error\": \"...\"}` for a question that failed); `changed` lists the questions whose answer changed; `chars` is the document length the decision covers.\n- `{\"type\": \"error\", \"detail\": \"...\", \"code\": \"...\", \"fatal\": false, \"seq\": 7}`: with `fatal: true` the server closes the session after it.\n- `{\"type\": \"ping\"}` every 25 s, a heartbeat that keeps idle connections open through proxies; ignore it. `{\"type\": \"pong\"}` answers your ping.\n\n**Limits.** The rendered prompt (the document plus the questions) may be at most 16,384 tokens. An `append` or `questions` frame that would exceed it is refused with `{\"type\": \"error\", \"code\": \"prompt_too_long\", \"tokens\": n, \"max_tokens\": 16384, \"fatal\": false}` and not applied; the session stays open for `questions`, `evaluate` and `close`. A `start` frame over the limit is fatal (close code 1009). At most 600,000 characters per session and 32 questions. A session that receives no client frame for 300 s is closed: send `{\"type\": \"ping\"}` to keep it open.\n\n**Drain.** When the server restarts it finishes the evaluation in flight (that decision is still sent and billed), sends `{\"type\": \"error\", \"code\": \"draining\", \"fatal\": true}` and closes with code 1012, reason \"server draining, reconnect\". Reconnect and send `start` with the full content.\n\n**Close codes.** 1000: normal close. 1008: the first frame is not a valid `start`, or the key is rejected. 1009: `start` content over the token limit. 1012: the server is draining.\n\n**Billing**, per update (an evaluation that answered at least one question). Input: the content that is new since the previous update (the first update: the whole document), plus the questions' own tokens, plus the reasoning prompt when reasoning runs. Output: the decision frame as sent, plus the reasoning tokens generated when reasoning runs. The frame's `usage` states it: `{\"update\", \"input_tokens\", \"document_tokens\", \"question_tokens\", \"output_tokens\"}`. An update whose frame is not sent (`emit: changes` and nothing changed) bills no output. `ready`, `ping`, `pong` and `error` frames are not billed.","operationId":"stream_v1_stream_websocket","x-websocket":true,"security":[{"HTTPBearer":[]}],"responses":{"101":{"description":"Switching Protocols: the WebSocket session is open; send the `start` frame."}}}}},"components":{"schemas":{"AbsentOption":{"properties":{"value":{"type":"null","title":"Value","description":"null: not in the document."},"probability":{"type":"number","title":"Probability","description":"Probability that the document does not state this field."}},"additionalProperties":false,"type":"object","required":["probability"],"title":"AbsentOption","description":"The option \"not in the document\"."},"Annotation":{"properties":{"type":{"type":"string","const":"url_citation","title":"Type","default":"url_citation"},"url_citation":{"$ref":"#/components/schemas/UrlCitation"}},"type":"object","required":["url_citation"],"title":"Annotation"},"BatchDecideResponsePublic":{"properties":{"results":{"items":{"$ref":"#/components/schemas/BatchGroupResultPublic"},"type":"array","title":"Results"},"meta":{"$ref":"#/components/schemas/BatchMetaPublic"}},"type":"object","required":["results","meta"],"title":"BatchDecideResponsePublic"},"BatchGroupResultPublic":{"properties":{"answers":{"items":{"$ref":"#/components/schemas/BatchQuestionAnswerPublic"},"type":"array","title":"Answers"}},"type":"object","required":["answers"],"title":"BatchGroupResultPublic"},"BatchMetaPublic":{"properties":{"model":{"type":"string","title":"Model","default":"levanto-sage-2"},"request_count":{"type":"integer","title":"Request Count"},"question_count":{"type":"integer","title":"Question Count"},"latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Ms"},"usage":{"anyOf":[{"$ref":"#/components/schemas/UsagePublic"},{"type":"null"}]}},"type":"object","required":["request_count","question_count"],"title":"BatchMetaPublic"},"BatchQuestionAnswerPublic":{"properties":{"ok":{"type":"boolean","title":"Ok"},"result":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/YesNoDecideResponsePublic"},{"$ref":"#/components/schemas/ChoiceDecideResponsePublic"},{"$ref":"#/components/schemas/ScaleDecideResponsePublic"},{"$ref":"#/components/schemas/SortDecideResponsePublic"},{"$ref":"#/components/schemas/TagsDecideResponsePublic"}],"discriminator":{"propertyName":"kind","mapping":{"choice":"#/components/schemas/ChoiceDecideResponsePublic","scale":"#/components/schemas/ScaleDecideResponsePublic","sort":"#/components/schemas/SortDecideResponsePublic","tags":"#/components/schemas/TagsDecideResponsePublic","yesno":"#/components/schemas/YesNoDecideResponsePublic"}}},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["ok"],"title":"BatchQuestionAnswerPublic"},"ChoiceAnswer":{"properties":{"type":{"type":"string","const":"choice","title":"Type","default":"choice"},"choice":{"type":"string","title":"Choice"},"confidence":{"type":"number","title":"Confidence"},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities"}},"type":"object","required":["choice","confidence","probabilities"],"title":"ChoiceAnswer"},"ChoiceDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"choice","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultChoice"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"ChoiceDecideResponsePublic"},"EstimateResponse":{"properties":{"usage":{"$ref":"#/components/schemas/UsageEstimate"}},"type":"object","required":["usage"],"title":"EstimateResponse"},"ExtractBatchItem":{"properties":{"ok":{"type":"boolean","title":"Ok","description":"false when this document failed; `error` says why."},"values":{"title":"Values","description":"As in the single-document response."},"results":{"anyOf":[{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/FieldResult"},{"$ref":"#/components/schemas/MentionsResult"}]},"type":"object"},{"$ref":"#/components/schemas/FieldResult"},{"$ref":"#/components/schemas/MentionsResult"},{"type":"null"}],"title":"Results","description":"As in the single-document response."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Why this document failed."}},"type":"object","required":["ok"],"title":"ExtractBatchItem","description":"One document of a batch, in request order."},"ExtractBatchResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/ExtractBatchItem"},"type":"array","title":"Results","description":"One item per document, in request order."},"meta":{"$ref":"#/components/schemas/ExtractMeta"}},"type":"object","required":["results","meta"],"title":"ExtractBatchResponse"},"ExtractCandidate":{"properties":{"value":{"title":"Value","description":"The value, in the field's type (see FieldType)."},"text":{"type":"string","title":"Text","description":"The text it was read from: content[start:end], verbatim."},"start":{"type":"integer","title":"Start","description":"Unicode code-point offset into content (inclusive)."},"end":{"type":"integer","title":"End","description":"Unicode code-point offset into content (exclusive)."},"probability":{"type":"number","title":"Probability","description":"Probability that this is the value."}},"additionalProperties":false,"type":"object","required":["value","text","start","end","probability"],"title":"ExtractCandidate","description":"A value found in the document, with where it was found."},"ExtractMeta":{"properties":{"model":{"type":"string","title":"Model","description":"The model that answered."},"mode":{"type":"string","const":"fast","title":"Mode","description":"The mode that answered."},"usage":{"$ref":"#/components/schemas/ExtractUsage"},"latency_ms":{"type":"number","title":"Latency Ms","description":"Time the server spent on this request, in milliseconds."},"head":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Head","description":"The version of the extraction model that answered."}},"type":"object","required":["model","mode","usage","latency_ms"],"title":"ExtractMeta"},"ExtractResponse":{"properties":{"values":{"title":"Values","description":"The request filled in: every field, in request order; null when absent or undecided; a list for every-mention fields."},"results":{"anyOf":[{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/FieldResult"},{"$ref":"#/components/schemas/MentionsResult"}]},"type":"object"},{"$ref":"#/components/schemas/FieldResult"},{"$ref":"#/components/schemas/MentionsResult"}],"title":"Results","description":"Per field: the value, where it was found and its probabilities."},"meta":{"$ref":"#/components/schemas/ExtractMeta"}},"type":"object","required":["values","results","meta"],"title":"ExtractResponse","description":"The request filled in. `values`: the same shape as `extract` (an object of values, the one value, or the list\nof values). `results`: the same keys, each field's value with where it was found and its probabilities (for a bare\nquestion or a one-question list, that one result)."},"ExtractUsage":{"properties":{"input_tokens":{"type":"integer","title":"Input Tokens","description":"The prompt Sage reads for each document: your content, the field names and definitions, and its instructions."},"output_tokens":{"type":"integer","title":"Output Tokens","description":"The size of this response body as sent, in tokens."}},"type":"object","required":["input_tokens","output_tokens"],"title":"ExtractUsage","description":"Tokens this request is billed for: input_tokens at the input rate, output_tokens at the output rate."},"FieldResult":{"properties":{"parse_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parse Error","description":"Present only when the field had candidates and none of them reads as the field's type."},"value":{"title":"Value","description":"The value in the field's type; null when absent or undecided."},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text","description":"The text the value was read from, verbatim."},"start":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Start","description":"Unicode code-point offset into content (inclusive)."},"end":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"End","description":"Unicode code-point offset into content (exclusive)."},"probability":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Probability","description":"Probability of what was returned: of the value, or, when `value` is null, that the document does not state it."},"probabilities":{"items":{"anyOf":[{"$ref":"#/components/schemas/ExtractCandidate"},{"$ref":"#/components/schemas/AbsentOption"}]},"type":"array","title":"Probabilities","description":"Every candidate, most likely first (candidates that read as the same value are merged), then `{\"value\": null}` = not in the document. Sums to 1."}},"additionalProperties":false,"type":"object","required":["probabilities"],"title":"FieldResult","description":"A one-value field. Found: `value`, where it was found, and its probability. No value: `value` null and\n`probability` = the probability that the document does not state it: high means it is not there, low means it is\nprobably there but no candidate was clear enough (the best candidates are in `probabilities`)."},"GroundingMetaPublic":{"properties":{"triggered":{"type":"boolean","title":"Triggered"},"trigger_reason":{"anyOf":[{"type":"string","enum":["never","confidence_above_floor","low_confidence","always","low_confidence_no_query","low_confidence_search_failed","low_confidence_no_context","always_no_query","always_search_failed","always_no_context"]},{"type":"null"}],"title":"Trigger Reason"},"queries":{"items":{"type":"string"},"type":"array","title":"Queries"},"sources":{"items":{"$ref":"#/components/schemas/Source"},"type":"array","title":"Sources"},"added_context_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Added Context Tokens"},"search_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Search Ms"}},"type":"object","required":["triggered"],"title":"GroundingMetaPublic"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"MentionsResult":{"properties":{"parse_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parse Error","description":"Present only when the field had candidates and none of them reads as the field's type."},"values":{"items":{"$ref":"#/components/schemas/ExtractCandidate"},"type":"array","title":"Values","description":"Every mention, in document order."}},"additionalProperties":false,"type":"object","required":["values"],"title":"MentionsResult","description":"An every-mention field: every mention in document order, `[]` when there is none."},"MetaPublic":{"properties":{"model":{"type":"string","title":"Model","default":"levanto-sage-2"},"latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Ms"},"question_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Question Count"},"usage":{"anyOf":[{"$ref":"#/components/schemas/UsagePublic"},{"type":"null"}]},"reasoning":{"anyOf":[{"$ref":"#/components/schemas/ReasoningMetaPublic"},{"type":"null"}],"description":"Reasoning pass accounting: whether the pass `ran` and `finished`, and its generated `tokens`. Omitted on kinds without reasoning. When omitted, this deployment's default applies: the `default` published for this field.","default":"off"},"escalated":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Escalated","description":"Only present when `true`: a `latency_mode: fast` choice answer was not confident enough, so the server re-scored it with the more accurate per-option pass and returned that answer."}},"type":"object","title":"MetaPublic"},"ModelMetadata":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"release_date":{"type":"string","title":"Release Date"}},"type":"object","required":["name","description","release_date"],"title":"ModelMetadata"},"ModelMetadataList":{"properties":{"models":{"items":{"$ref":"#/components/schemas/ModelMetadata"},"type":"array","title":"Models"}},"type":"object","required":["models"],"title":"ModelMetadataList"},"NoulAnswer":{"properties":{"type":{"type":"string","const":"noul","title":"Type","default":"noul"},"noul":{"type":"number","title":"Noul"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","required":["noul"],"title":"NoulAnswer"},"ReasoningMetaPublic":{"properties":{"ran":{"type":"boolean","title":"Ran","description":"The reasoning pass executed."},"finished":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Finished","description":"The reasoning chain completed within the budget; `false` means the fast answer was returned, unless `forced` is `true`; `null` when it did not run."},"tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens","description":"Reasoning tokens generated. Reasoning tokens are counted as output tokens."},"limited":{"anyOf":[{"type":"string","enum":["cap","timeout","budget"]},{"type":"null"}],"title":"Limited","description":"Why the reasoning chain did not complete: `cap` (token cap), `timeout` (time budget expired during generation), `budget` (the budget was consumed waiting for a reasoning slot)."},"forced":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Forced","description":"Only present when the chain was cut (`limited` = `timeout` or `cap`) and the server answers from the partial chain: `true` = the answer came from the truncated reasoning, `false` = that attempt failed and the fast answer was returned."}},"type":"object","required":["ran"],"title":"ReasoningMetaPublic","description":"Reasoning pass accounting for one answer, as returned to clients: whether the pass `ran` and `finished`,\nits generated `tokens` (billed as output tokens), and, when the chain was cut, `limited` and `forced`."},"ResultChoice":{"properties":{"chosen":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chosen"},"probability":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Probability"},"probabilities":{"items":{"$ref":"#/components/schemas/ResultChoiceOption"},"type":"array","title":"Probabilities"},"abstained":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Abstained"}},"type":"object","required":["chosen","probability","probabilities"],"title":"ResultChoice"},"ResultChoiceOption":{"properties":{"option":{"type":"string","title":"Option"},"probability":{"type":"number","title":"Probability"}},"type":"object","required":["option","probability"],"title":"ResultChoiceOption"},"ResultScale":{"properties":{"expectation":{"type":"number","title":"Expectation"},"probabilities":{"anyOf":[{"items":{"$ref":"#/components/schemas/ResultScaleLevel"},"type":"array"},{"type":"null"}],"title":"Probabilities"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["expectation","confidence"],"title":"ResultScale"},"ResultScaleLevel":{"properties":{"level":{"type":"integer","title":"Level"},"probability":{"type":"number","title":"Probability"}},"type":"object","required":["level","probability"],"title":"ResultScaleLevel"},"ResultSort":{"properties":{"sorted":{"items":{"type":"string"},"type":"array","title":"Sorted"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","required":["sorted"],"title":"ResultSort"},"ResultTagEntry":{"properties":{"id":{"type":"string","title":"Id"},"probability":{"type":"number","title":"Probability"},"applies":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Applies"}},"type":"object","required":["id","probability"],"title":"ResultTagEntry"},"ResultTags":{"properties":{"tags":{"items":{"$ref":"#/components/schemas/ResultTagEntry"},"type":"array","title":"Tags"}},"type":"object","required":["tags"],"title":"ResultTags"},"ResultYesNo":{"properties":{"answer":{"anyOf":[{"type":"string","enum":["yes","no"]},{"type":"null"}],"title":"Answer"},"probability":{"type":"number","title":"Probability"}},"type":"object","required":["answer","probability"],"title":"ResultYesNo"},"ScaleDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"scale","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultScale"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"ScaleDecideResponsePublic"},"ScoreAnswer":{"properties":{"type":{"type":"string","const":"score","title":"Type","default":"score"},"score":{"type":"number","title":"Score"},"confidence":{"type":"number","title":"Confidence"},"legend":{"additionalProperties":true,"type":"object","title":"Legend"},"probabilities":{"additionalProperties":{"type":"number"},"type":"object","title":"Probabilities"}},"type":"object","required":["score","confidence","legend","probabilities"],"title":"ScoreAnswer"},"SortAnswer":{"properties":{"type":{"type":"string","const":"sort","title":"Type","default":"sort"},"sorted":{"items":{"type":"string"},"type":"array","title":"Sorted"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","required":["sorted"],"title":"SortAnswer"},"SortDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"sort","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultSort"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"SortDecideResponsePublic"},"Source":{"properties":{"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snippet"}},"type":"object","title":"Source"},"SystemOneResponse":{"properties":{"model":{"type":"string","title":"Model"},"answers":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/NoulAnswer"},{"$ref":"#/components/schemas/ChoiceAnswer"},{"$ref":"#/components/schemas/ScoreAnswer"},{"$ref":"#/components/schemas/SortAnswer"}]},"type":"object","title":"Answers"},"usage":{"$ref":"#/components/schemas/Usage"},"annotations":{"anyOf":[{"items":{"$ref":"#/components/schemas/Annotation"},"type":"array"},{"type":"null"}],"title":"Annotations"}},"type":"object","required":["model","answers","usage"],"title":"SystemOneResponse"},"TagsDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"tags","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultTags"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"TagsDecideResponsePublic"},"UrlCitation":{"properties":{"url":{"type":"string","title":"Url"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"}},"type":"object","required":["url"],"title":"UrlCitation"},"Usage":{"properties":{"input_tokens":{"type":"integer","title":"Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"}},"type":"object","required":["input_tokens","output_tokens"],"title":"Usage"},"UsageEstimate":{"properties":{"min_input_tokens":{"type":"integer","title":"Min Input Tokens"},"max_input_tokens":{"type":"integer","title":"Max Input Tokens"},"exact":{"type":"boolean","title":"Exact"},"min_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Output Tokens"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"sequences":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sequences"},"basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basis"}},"type":"object","required":["min_input_tokens","max_input_tokens","exact"],"title":"UsageEstimate","description":"Predicts input_tokens and output_tokens for a request body without running it.\n\nThe min_* and max_* fields bound the input_tokens and output_tokens the real response reports in meta.usage;\nexact is true when they coincide. When reasoning or grounding may run, max_* assumes they run with their full\nbudget and min_* assumes they do not. For sort questions the prediction is approximate and exact is false.\nImages are not included: the response reports them in meta.usage.image_tokens."},"UsagePublic":{"properties":{"billed_input_tokens":{"type":"integer","title":"Billed Input Tokens","description":"Everything charged at the input rate: input_tokens + image_tokens."},"rendered_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rendered Tokens","description":"Tokens the model processed, with your content counted once per question it answers. Not charged."},"image_count":{"type":"integer","title":"Image Count","default":0},"image_tokens":{"type":"integer","title":"Image Tokens","description":"Tokens for the images in this request (0 when there are none). Counted like input tokens.","default":0},"input_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Input Tokens","description":"Tokens Sage read to answer this request: your content and question, plus the instructions and options that go with each question. Content shared by several questions of one request, or of one batch item, is counted once; reasoning reads it again and counts it again. Images are counted in image_tokens."},"output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Tokens","description":"Tokens Sage wrote while reasoning (its thinking and the reasoned answer). 0 when no question reasoned."}},"type":"object","required":["billed_input_tokens"],"title":"UsagePublic","description":"Tokens this request used, charged at your plan's rates: input_tokens and image_tokens at the input rate,\noutput_tokens at the output rate."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"YesNoDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"yesno","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultYesNo"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"YesNoDecideResponsePublic"},"ChoiceOptionModel":{"additionalProperties":false,"properties":{"option":{"title":"Option","type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["option"],"title":"ChoiceOptionModel","type":"object"},"ChoiceQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"choice","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"options":{"items":{"$ref":"#/components/schemas/ChoiceOptionModel"},"maxItems":256,"minItems":2,"title":"Options","type":"array"}},"required":["kind","id","instructions","options"],"title":"ChoiceQuestion","type":"object"},"GroundingConfig":{"additionalProperties":false,"properties":{"provider":{"anyOf":[{"const":"brave","type":"string"},{"type":"null"}],"default":null,"description":"Optional. The only supported value is \"brave\".","title":"Provider"},"trigger":{"default":"low_confidence","enum":["always","low_confidence","never"],"title":"Trigger","type":"string"},"confidence_floor":{"default":0.8,"maximum":1.0,"minimum":0.0,"title":"Confidence Floor","type":"number"},"max_results":{"default":10,"maximum":20,"minimum":1,"title":"Max Results","type":"integer"},"max_context_tokens":{"default":2000,"maximum":8000,"minimum":1,"title":"Max Context Tokens","type":"integer"},"return_sources":{"default":true,"title":"Return Sources","type":"boolean"}},"title":"GroundingConfig","type":"object"},"ImageContent":{"additionalProperties":false,"description":"One image to judge, with optional accompanying text.\n\n`media` must be a base64 `data:` URI (`image/png`, `image/jpeg`\nor `image/webp`), at most 4 MiB decoded, with longest edge at most\n8192 px and width×height at most 4096². Remote URLs are not accepted.\n`text` is optional: omit it to judge the image alone, or set it to\njudge the image together with surrounding text (e.g. a screenshot plus\nthe ticket that reported it).\n\nSupported for question kinds `yesno`, `scale`, `tags` and\n`choice`. A `choice` question with image content accepts at most 20\noptions (text-only choice allows CHOICE_OPTIONS_MAX, 256), because each option costs\nits own pass over the image. Not supported with `sort`, inside a\n`list` item, or together with `grounding`; those combinations are\nrejected with a 400.","properties":{"kind":{"const":"image","default":"image","title":"Kind","type":"string"},"media":{"title":"Media","type":"string"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Text"}},"required":["media"],"title":"ImageContent","type":"object"},"ListContentPublic":{"additionalProperties":false,"description":"An ordered set of items to be sorted (used by `kind: sort`).","properties":{"kind":{"const":"list","default":"list","title":"Kind","type":"string"},"value":{"items":{"$ref":"#/components/schemas/ListItemPublic"},"maxItems":120,"minItems":2,"title":"Value","type":"array"}},"required":["value"],"title":"ListContentPublic","type":"object"},"ListItemPublic":{"additionalProperties":false,"properties":{"id":{"title":"Id","type":"string"},"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"image":"#/components/schemas/ImageContent","list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ImageContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"title":"Content"}},"required":["id","content"],"title":"ListItemPublic","type":"object"},"ScaleLevelModel":{"additionalProperties":false,"properties":{"level":{"title":"Level","type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["level"],"title":"ScaleLevelModel","type":"object"},"ScaleQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"scale","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"levels":{"items":{"$ref":"#/components/schemas/ScaleLevelModel"},"maxItems":26,"minItems":2,"title":"Levels","type":"array"}},"required":["kind","id","instructions","levels"],"title":"ScaleQuestion","type":"object"},"SortQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"sort","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"}},"required":["kind","id","instructions"],"title":"SortQuestion","type":"object"},"TagSpec":{"additionalProperties":false,"properties":{"id":{"title":"Id","type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"threshold":{"anyOf":[{"maximum":1.0,"minimum":0.0,"type":"number"},{"type":"null"}],"default":null,"deprecated":true,"description":"Deprecated: accepted and ignored. `applies` is Sage's own verdict.","title":"Threshold"}},"required":["id"],"title":"TagSpec","type":"object"},"TagsQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"tags","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Instructions"},"tags":{"items":{"$ref":"#/components/schemas/TagSpec"},"maxItems":120,"minItems":1,"title":"Tags","type":"array"}},"required":["kind","id","tags"],"title":"TagsQuestion","type":"object"},"TextContent":{"additionalProperties":false,"properties":{"kind":{"const":"text","default":"text","title":"Kind","type":"string"},"value":{"title":"Value","type":"string"}},"required":["value"],"title":"TextContent","type":"object"},"YesNoQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"yesno","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"}},"required":["kind","id","instructions"],"title":"YesNoQuestion","type":"object"},"DecideRequestPublic":{"additionalProperties":false,"properties":{"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"image":"#/components/schemas/ImageContent","list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ImageContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"description":"Document or item list to judge. Together with `question` (and any grounding-added context), the full rendered request must fit within 131072 tokens. `kind: \"image\"` content is wired for question kinds yesno/scale/tags/choice (choice capped at 20 options), and cannot be combined with grounding.","maxTokens":131072,"title":"Content"},"question":{"discriminator":{"mapping":{"choice":"#/components/schemas/ChoiceQuestion","scale":"#/components/schemas/ScaleQuestion","sort":"#/components/schemas/SortQuestion","tags":"#/components/schemas/TagsQuestion","yesno":"#/components/schemas/YesNoQuestion"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/YesNoQuestion"},{"$ref":"#/components/schemas/ChoiceQuestion"},{"$ref":"#/components/schemas/ScaleQuestion"},{"$ref":"#/components/schemas/SortQuestion"},{"$ref":"#/components/schemas/TagsQuestion"}],"title":"Question"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null},"reasoning":{"default":"off","description":"Reasoning pass. `auto`: answer from the fast pass and run the reasoning pass only when the model's own first-token signal says the question needs it (see `meta.reasoning`). `off`: fast pass only, never reason. `on`: always run the reasoning pass. Reasoning counts toward usage like any other tokens: what it reads is counted as input tokens and what it writes as output tokens. When omitted, this deployment's default applies: the `default` published for this field.","enum":["auto","off","on"],"title":"Reasoning","type":"string"},"latency_mode":{"default":"fast","description":"Accuracy/latency trade for choice questions. `quality` scores every option in its own pass over the document (one short prefill per option on the cached document) on top of the single-pass read-out: the most accurate mode, about +100 ms per choice question. `fast` keeps the single-pass read-out only: cost flat in the number of options, measurably less accurate on multi-step questions. Yes/no, scale, tags and sort are identical in both modes. When omitted, this deployment's default applies: the `default` published for this field.","enum":["quality","fast"],"title":"Latency Mode","type":"string"}},"required":["content","question"],"title":"DecideRequestPublic","type":"object"},"BatchChoiceQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"choice","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"options":{"items":{"$ref":"#/components/schemas/ChoiceOptionModel"},"maxItems":256,"minItems":2,"title":"Options","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions","options"],"title":"BatchChoiceQuestion","type":"object"},"BatchDecideItemPublic":{"additionalProperties":false,"properties":{"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"image":"#/components/schemas/ImageContent","list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ImageContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"description":"Document or item list shared by every question in this group. Together with all of `questions` (and any grounding-added context), the full rendered request must fit within 131072 tokens. `kind: \"image\"` content is wired for question kinds yesno/scale/tags/choice (choice capped at 20 options), and cannot be combined with grounding.","maxTokens":131072,"title":"Content"},"questions":{"items":{"discriminator":{"mapping":{"choice":"#/components/schemas/BatchChoiceQuestion","scale":"#/components/schemas/BatchScaleQuestion","sort":"#/components/schemas/BatchSortQuestion","tags":"#/components/schemas/BatchTagsQuestion","yesno":"#/components/schemas/BatchYesNoQuestion"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/BatchYesNoQuestion"},{"$ref":"#/components/schemas/BatchChoiceQuestion"},{"$ref":"#/components/schemas/BatchScaleQuestion"},{"$ref":"#/components/schemas/BatchSortQuestion"},{"$ref":"#/components/schemas/BatchTagsQuestion"}]},"minItems":1,"title":"Questions","type":"array"}},"required":["content","questions"],"title":"BatchDecideItemPublic","type":"object"},"BatchScaleQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"scale","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"levels":{"items":{"$ref":"#/components/schemas/ScaleLevelModel"},"maxItems":26,"minItems":2,"title":"Levels","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions","levels"],"title":"BatchScaleQuestion","type":"object"},"BatchSortQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"sort","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions"],"title":"BatchSortQuestion","type":"object"},"BatchTagsQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"tags","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Instructions"},"tags":{"items":{"$ref":"#/components/schemas/TagSpec"},"maxItems":120,"minItems":1,"title":"Tags","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","tags"],"title":"BatchTagsQuestion","type":"object"},"BatchYesNoQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"yesno","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions"],"title":"BatchYesNoQuestion","type":"object"},"BatchDecideRequestPublic":{"additionalProperties":false,"properties":{"requests":{"items":{"$ref":"#/components/schemas/BatchDecideItemPublic"},"minItems":1,"title":"Requests","type":"array"},"latency_mode":{"default":"fast","description":"Accuracy/latency trade for choice questions. `quality` scores every option in its own pass over the document (one short prefill per option on the cached document) on top of the single-pass read-out: the most accurate mode, about +100 ms per choice question. `fast` keeps the single-pass read-out only: cost flat in the number of options, measurably less accurate on multi-step questions. Yes/no, scale, tags and sort are identical in both modes. When omitted, this deployment's default applies: the `default` published for this field.","enum":["quality","fast"],"title":"Latency Mode","type":"string"},"reasoning":{"default":"off","description":"Reasoning pass. `auto`: answer from the fast pass and run the reasoning pass only when the model's own first-token signal says the question needs it (see `meta.reasoning`). `off`: fast pass only, never reason. `on`: always run the reasoning pass. Reasoning counts toward usage like any other tokens: what it reads is counted as input tokens and what it writes as output tokens. When omitted, this deployment's default applies: the `default` published for this field.","enum":["auto","off","on"],"title":"Reasoning","type":"string"}},"required":["requests"],"title":"BatchDecideRequestPublic","type":"object"},"SageErrorResponse":{"description":"An error. `detail` is one human-readable message.","properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"SageErrorResponse","type":"object"},"EveryMention":{"description":"Every mention, in document order: a list holding exactly one field spec, e.g. `[\"A named person who signs.\"]`,\n`[\"\"]` or `[{\"type\": \"money\"}]`.","items":{"$ref":"#/components/schemas/FieldSpec"},"maxItems":1,"minItems":1,"title":"EveryMention","type":"array"},"ExtractFields":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/FieldSpec"},{"$ref":"#/components/schemas/EveryMention"}]},"description":"What to extract: field name -> spec. A name may be a question. Names come back unchanged, in request order, and\nmust be unique (compared ignoring case, and `_` counts as a space); no double quotes or line breaks.","maxProperties":64,"minProperties":1,"propertyNames":{"maxLength":256,"minLength":1},"title":"ExtractFields","type":"object"},"FieldSpec":{"anyOf":[{"maxLength":4000,"type":"string"},{"$ref":"#/components/schemas/TypedField"},{"type":"null"}],"description":"One value. A string is the field's definition (a question works too); `\"\"` or `null`: the name says it all, the\nvalue is text; `{\"type\": ..., \"definition\": ...}`: a typed value.","title":"FieldSpec"},"FieldType":{"description":"The type of a field's value. `text` (the default): the span, verbatim. `integer`: a whole number, never rounded\n(\"12,000 sq ft\" -> 12000; a candidate that is not whole is skipped). `decimal`: any number, as stated (\"19 % USt\"\n-> 19). `money`: `{\"amount\": number, \"currency\": ISO 4217 code or null}` (\"1.930,78 €\" -> `{\"amount\": 1930.78,\n\"currency\": \"EUR\"}`; `currency` is null when the text names none). `date`: `\"YYYY-MM-DD\"`, or `\"YYYY-MM\"` when only\nthe month is stated. `time`: `\"HH:MM\"`, plus the UTC offset when a time zone is written (\"14:00 CET\" ->\n`\"14:00+01:00\"`). `datetime`: ISO 8601 (\"23 October 2026 at 14:00 CET\" -> `\"2026-10-23T14:00+01:00\"`). `duration`:\nan ISO 8601 duration (\"three (3) years\" -> `\"P3Y\"`). Values are read only from what the text states: no relative\ndates, no missing years filled in, no unit or currency conversion; units are dropped (ask for `text` to keep them).","enum":["text","integer","decimal","money","date","time","datetime","duration"],"title":"FieldType","type":"string"},"QuestionList":{"description":"Every answer to one question: a list holding exactly one question string, e.g. `[\"Who signed?\"]`.","items":{"maxLength":256,"minLength":1,"pattern":"^[^\"\\r\\n]+$","type":"string"},"maxItems":1,"minItems":1,"title":"QuestionList","type":"array"},"TypedField":{"additionalProperties":false,"description":"A field with a type. Both keys are optional (`{}` is a text field); no other keys are accepted.","properties":{"type":{"$ref":"#/components/schemas/FieldType","default":"text","description":"The type of the value. See FieldType."},"definition":{"anyOf":[{"maxLength":4000,"type":"string"},{"type":"null"}],"default":null,"description":"What counts as this field, in plain words. A question works too. Empty or null: the field's name says it all.","title":"Definition"}},"title":"TypedField","type":"object"},"ExtractRequest":{"additionalProperties":false,"description":"`POST /v1/extract`: one document.","properties":{"content":{"description":"The text to extract from. Offsets in the response index this string by Unicode code point.","minLength":1,"title":"Content","type":"string"},"extract":{"anyOf":[{"$ref":"#/components/schemas/ExtractFields"},{"maxLength":256,"minLength":1,"pattern":"^[^\"\\r\\n]+$","type":"string"},{"$ref":"#/components/schemas/QuestionList"}],"description":"What to find. An object `{name: spec}` names the fields; a bare question string asks for one answer; a list holding one question asks for every answer. The response has the same shape: `values` fills it in, `results` explains each value.","title":"Extract"},"mode":{"const":"fast","default":"fast","description":"`fast` (the default and only mode): one forward pass, no generation.","title":"Mode","type":"string"}},"required":["content","extract"],"title":"ExtractRequest","type":"object"},"ExtractBatchRequest":{"additionalProperties":false,"description":"`POST /v1/extract/batch`: several documents, one `extract` for all of them.","properties":{"contents":{"description":"The documents, answered in this order. Offsets index each document by Unicode code point.","items":{"type":"string"},"maxItems":64,"minItems":1,"title":"Contents","type":"array"},"extract":{"anyOf":[{"$ref":"#/components/schemas/ExtractFields"},{"maxLength":256,"minLength":1,"pattern":"^[^\"\\r\\n]+$","type":"string"},{"$ref":"#/components/schemas/QuestionList"}],"description":"What to find. An object `{name: spec}` names the fields; a bare question string asks for one answer; a list holding one question asks for every answer. The response has the same shape: `values` fills it in, `results` explains each value.","title":"Extract"},"mode":{"const":"fast","default":"fast","description":"`fast` (the default and only mode): one forward pass, no generation.","title":"Mode","type":"string"}},"required":["contents","extract"],"title":"ExtractBatchRequest","type":"object"},"SystemOneChoiceQuestion":{"properties":{"type":{"const":"choice","title":"Type","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Instructions"},"criteria":{"additionalProperties":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}]},"title":"Criteria","type":"object"}},"required":["type","criteria"],"title":"ChoiceQuestion","type":"object"},"GroundingOption":{"additionalProperties":false,"description":"Web-search grounding for a question (Brave). Every key is optional.","properties":{"provider":{"anyOf":[{"const":"brave","type":"string"},{"type":"null"}],"default":null,"description":"Optional; the only supported value is \"brave\".","title":"Provider"},"trigger":{"anyOf":[{"enum":["always","low_confidence","never"],"type":"string"},{"type":"null"}],"default":null,"description":"`always`: search before answering. `low_confidence` (default): search when the first answer's confidence is below `confidence_floor`. `never`: no search.","title":"Trigger"},"confidence_floor":{"anyOf":[{"maximum":1.0,"minimum":0.0,"type":"number"},{"type":"null"}],"default":null,"description":"Default 0.8.","title":"Confidence Floor"},"max_results":{"anyOf":[{"maximum":20,"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"description":"Search results read. Default 10.","title":"Max Results"},"max_context_tokens":{"anyOf":[{"maximum":8000,"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"description":"Tokens of search text added. Default 2000.","title":"Max Context Tokens"},"return_sources":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Return the sources as `annotations`. Default true.","title":"Return Sources"}},"title":"GroundingOption","type":"object"},"NoulCriteria":{"properties":{"true":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"True"},"false":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"False"}},"title":"NoulCriteria","type":"object"},"NoulQuestion":{"properties":{"type":{"const":"noul","title":"Type","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Instructions"},"criteria":{"anyOf":[{"$ref":"#/components/schemas/NoulCriteria"},{"type":"null"}],"default":null}},"required":["type"],"title":"NoulQuestion","type":"object"},"ProviderEnvelope":{"additionalProperties":true,"description":"OpenRouter's `provider` object. Only `options.levanto` / `options[\"near-ai\"]` are read; other keys are ignored.","properties":{"options":{"anyOf":[{"$ref":"#/components/schemas/ProviderOptions"},{"type":"null"}],"default":null}},"title":"ProviderEnvelope","type":"object"},"ProviderOptions":{"additionalProperties":true,"properties":{"levanto":{"anyOf":[{"$ref":"#/components/schemas/SystemOneOptions"},{"type":"null"}],"default":null},"near-ai":{"anyOf":[{"$ref":"#/components/schemas/SystemOneOptions"},{"type":"null"}],"default":null}},"title":"ProviderOptions","type":"object"},"ScoreQuestion":{"properties":{"type":{"const":"score","title":"Type","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"default":null,"title":"Instructions"},"criteria":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}]},"minItems":1,"title":"Criteria","type":"array"}},"required":["type","criteria"],"title":"ScoreQuestion","type":"object"},"SortOption":{"additionalProperties":false,"description":"Sort a list from the state. The answer is `{\"type\": \"sort\", \"sorted\": [ids], \"confidence\"}` under the sort's name.","properties":{"items":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Key of `state` holding the list: an object (ids = its keys) or an array (ids = positions as strings), 2 to 120 items. Omitted: `state` itself.","title":"Items"},"instructions":{"description":"The order wanted, e.g. `Most urgent first`.","title":"Instructions","type":"string"}},"required":["instructions"],"title":"SortOption","type":"object"},"SystemOneOptions":{"additionalProperties":false,"description":"Provider options: under `provider.options.levanto` or `provider.options[\"near-ai\"]` (same keys), or at the top\nlevel of the body. A key given twice with different values, or an unknown key, is a 422.","properties":{"reasoning":{"anyOf":[{"enum":["off","auto","on"],"type":"string"},{"type":"null"}],"default":"off","description":"Reasoning pass. When omitted, this deployment's default applies: the `default` published for this field.","title":"Reasoning"},"latency_mode":{"anyOf":[{"enum":["quality","fast"],"type":"string"},{"type":"null"}],"default":"fast","description":"Accepted for compatibility; no effect on this model. When omitted, this deployment's default applies: the `default` published for this field.","title":"Latency Mode"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingOption"},{"additionalProperties":{"$ref":"#/components/schemas/GroundingOption"},"type":"object"},{"type":"null"}],"default":null,"description":"One grounding config for every question, or `{question name: config}`. A question in a tag set grounds its whole set.","title":"Grounding"},"tags":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/TagSetOption"},"type":"object"},{"type":"null"}],"default":null,"description":"`{set name: tag set}`.","title":"Tags"},"sort":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/SortOption"},"type":"object"},{"type":"null"}],"default":null,"description":"`{sort name: sort}`. The name must not be a question's.","title":"Sort"}},"title":"SystemOneOptions","type":"object"},"TagSetOption":{"additionalProperties":false,"description":"Answer several `noul` questions with one tag-set read: each listed question still gets its own `noul` answer.","properties":{"questions":{"description":"Names of `noul` questions of this request; a question may be in one set only.","items":{"type":"string"},"maxItems":120,"minItems":1,"title":"Questions","type":"array"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the set is about (e.g. `Moderation`).","title":"Instructions"}},"required":["questions"],"title":"TagSetOption","type":"object"},"SystemOneRequest":{"additionalProperties":true,"description":"`POST /v1/systemone`: TypeSafe / OpenRouter Decisions request, plus Sage's provider options.","properties":{"state":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}],"description":"The text or JSON the questions are about.","title":"State"},"model":{"description":"The served model name or `sage-latest` (`GET /v1/models`).","title":"Model","type":"string"},"questions":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/NoulQuestion"},{"$ref":"#/components/schemas/SystemOneChoiceQuestion"},{"$ref":"#/components/schemas/ScoreQuestion"}]},"description":"`{name: noul | choice | score question}`.","maxProperties":64,"minProperties":1,"title":"Questions","type":"object"},"reasoning":{"anyOf":[{"enum":["off","auto","on"],"type":"string"},{"type":"null"}],"default":"off","title":"Reasoning","description":"When omitted, this deployment's default applies: the `default` published for this field."},"latency_mode":{"anyOf":[{"enum":["quality","fast"],"type":"string"},{"type":"null"}],"default":"fast","title":"Latency Mode","description":"When omitted, this deployment's default applies: the `default` published for this field."},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingOption"},{"additionalProperties":{"$ref":"#/components/schemas/GroundingOption"},"type":"object"},{"type":"null"}],"default":null,"title":"Grounding"},"tags":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/TagSetOption"},"type":"object"},{"type":"null"}],"default":null,"title":"Tags"},"sort":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/SortOption"},"type":"object"},{"type":"null"}],"default":null,"title":"Sort"},"provider":{"anyOf":[{"$ref":"#/components/schemas/ProviderEnvelope"},{"type":"null"}],"default":null}},"required":["state","model","questions"],"title":"SystemOneRequest","type":"object"},"DateFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"date","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unit label, echoed; it does not change the read.","title":"Unit"}},"required":["type"],"title":"DateFieldSpec","type":"object"},"DatetimeFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"datetime","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unit label, echoed; it does not change the read.","title":"Unit"}},"required":["type"],"title":"DatetimeFieldSpec","type":"object"},"DurationFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"duration","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"enum":["seconds","minutes","hours","days","weeks","months","years"],"type":"string"},{"type":"null"}],"default":null,"description":"Convert to a number in this unit (month = 30 days, year = 365 days across the calendar/clock divide). Omitted: an ISO 8601 duration such as `P3Y`.","title":"Unit"},"integer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Round to a whole number (needs `unit`).","title":"Integer"},"decimals":{"anyOf":[{"maximum":6,"minimum":0,"type":"integer"},{"type":"null"}],"default":null,"description":"Decimal places (needs `unit`).","title":"Decimals"}},"required":["type"],"title":"DurationFieldSpec","type":"object"},"ExtractionsOptions":{"additionalProperties":false,"description":"Options under `provider.options.levanto` or `provider.options[\"near-ai\"]` (or at the top level).","properties":{"return_state_text":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Return `state` as `state_text` (the text spans index).","title":"Return State Text"},"candidates":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Add `candidates`: every candidate with its span and probability.","title":"Candidates"}},"title":"ExtractionsOptions","type":"object"},"ExtractionsProvider":{"additionalProperties":true,"description":"OpenRouter's `provider` object; only `options.levanto` / `options[\"near-ai\"]` are read.","properties":{"options":{"anyOf":[{"$ref":"#/components/schemas/ExtractionsProviderOptions"},{"type":"null"}],"default":null}},"title":"ExtractionsProvider","type":"object"},"ExtractionsProviderOptions":{"additionalProperties":true,"properties":{"levanto":{"anyOf":[{"$ref":"#/components/schemas/ExtractionsOptions"},{"type":"null"}],"default":null},"near-ai":{"anyOf":[{"$ref":"#/components/schemas/ExtractionsOptions"},{"type":"null"}],"default":null}},"title":"ExtractionsProviderOptions","type":"object"},"ListFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"list","title":"Type","type":"string"},"items":{"description":"The type of each item.","enum":["text","number","date","time","datetime","duration"],"title":"Items","type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"As on the item type: a currency for numbers, seconds..years for durations, else a label.","title":"Unit"},"integer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Number or duration items only.","title":"Integer"},"decimals":{"anyOf":[{"maximum":6,"minimum":0,"type":"integer"},{"type":"null"}],"default":null,"description":"Number or duration items only.","title":"Decimals"}},"required":["type","items"],"title":"ListFieldSpec","type":"object"},"NumberFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"number","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A currency (`USD`, `$`, `euros`) reads the amount in that currency: a different stated currency gives `value` null, the amount in `guess` and the stated `currency`. Any other unit is a label.","title":"Unit"},"integer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Whole numbers only.","title":"Integer"},"decimals":{"anyOf":[{"maximum":6,"minimum":0,"type":"integer"},{"type":"null"}],"default":null,"description":"Decimal places kept in `value`.","title":"Decimals"}},"required":["type"],"title":"NumberFieldSpec","type":"object"},"TextFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"text","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unit label, echoed; it does not change the read.","title":"Unit"}},"required":["type"],"title":"TextFieldSpec","type":"object"},"TimeFieldSpec":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the field should contain, in plain words (a question works too). Up to 4,000 characters.","title":"Instructions"},"type":{"const":"time","title":"Type","type":"string"},"null_threshold":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"description":"`value` is null when `p_null` is above this. Default 0.5.","title":"Null Threshold"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unit label, echoed; it does not change the read.","title":"Unit"}},"required":["type"],"title":"TimeFieldSpec","type":"object"},"ExtractionsRequest":{"additionalProperties":false,"description":"`POST /api/alpha/extractions`: OpenRouter's Extractions request. Text only: `assets` and an empty `state` are a 400;\n`estimate` and `forecast` fields are a 400; `questions` is a 400 (send questions to `/v1/systemone`).","properties":{"model":{"description":"The served model name or `sage-latest`.","title":"Model","type":"string"},"state":{"description":"The text to read. Offsets index it by Unicode code point.","minLength":1,"title":"State","type":"string"},"fields":{"additionalProperties":{"discriminator":{"mapping":{"date":"#/components/schemas/DateFieldSpec","datetime":"#/components/schemas/DatetimeFieldSpec","duration":"#/components/schemas/DurationFieldSpec","list":"#/components/schemas/ListFieldSpec","number":"#/components/schemas/NumberFieldSpec","text":"#/components/schemas/TextFieldSpec","time":"#/components/schemas/TimeFieldSpec"},"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/TextFieldSpec"},{"$ref":"#/components/schemas/NumberFieldSpec"},{"$ref":"#/components/schemas/DateFieldSpec"},{"$ref":"#/components/schemas/TimeFieldSpec"},{"$ref":"#/components/schemas/DatetimeFieldSpec"},{"$ref":"#/components/schemas/DurationFieldSpec"},{"$ref":"#/components/schemas/ListFieldSpec"}]},"description":"`{name: field spec}`. Names are unique ignoring case and `_`; more than 64 are read in passes.","minProperties":1,"title":"Fields","type":"object"},"reference_date":{"anyOf":[{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"},{"type":"null"}],"default":null,"description":"Fills in the year of a date written without one: the nearest such date.","title":"Reference Date"},"provider":{"anyOf":[{"$ref":"#/components/schemas/ExtractionsProvider"},{"type":"null"}],"default":null},"return_state_text":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"title":"Return State Text"},"candidates":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"title":"Candidates"},"session_id":{"anyOf":[{"maxLength":256,"type":"string"},{"type":"null"}],"default":null,"description":"Accepted and ignored.","title":"Session Id"},"user":{"anyOf":[{"maxLength":256,"type":"string"},{"type":"null"}],"default":null,"description":"Accepted and ignored.","title":"User"},"trace":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Accepted and ignored.","title":"Trace"}},"required":["model","state","fields"],"title":"ExtractionsRequest","type":"object"},"ExtractionCandidate":{"properties":{"value":{"title":"Value"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Text"},"span":{"items":{"anyOf":[{"type":"integer"},{"type":"null"}]},"title":"Span","type":"array"},"probability":{"title":"Probability","type":"number"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Currency"}},"required":["value","span","probability"],"title":"ExtractionCandidate","type":"object"},"ExtractionsUsage":{"properties":{"input_tokens":{"description":"The prompt Sage reads in every pass.","title":"Input Tokens","type":"integer"},"output_tokens":{"description":"The size of this response body, in tokens.","title":"Output Tokens","type":"integer"},"passes":{"description":"Reads needed: one per 64 fields.","title":"Passes","type":"integer"}},"required":["input_tokens","output_tokens","passes"],"title":"ExtractionsUsage","type":"object"},"ListAnswer":{"properties":{"type":{"const":"list","title":"Type","type":"string"},"value":{"items":{},"title":"Value","type":"array"},"spans":{"items":{"items":{"type":"integer"},"type":"array"},"title":"Spans","type":"array"},"confidences":{"items":{"type":"number"},"title":"Confidences","type":"array"},"texts":{"items":{"type":"string"},"title":"Texts","type":"array"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Unit"},"candidates":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExtractionCandidate"},"type":"array"},{"type":"null"}],"default":null,"title":"Candidates"}},"required":["type","value","spans","confidences","texts"],"title":"ListAnswer","type":"object"},"OneValueAnswer":{"description":"`value` (null when `p_null` > `null_threshold`), `guess` (most likely value either way), `p_null`, and for a value\n`confidence`, `span` ([start, end) code points) and `text`.","properties":{"type":{"enum":["text","number","date","time","datetime","duration"],"title":"Type","type":"string"},"value":{"default":null,"title":"Value"},"guess":{"default":null,"title":"Guess"},"p_null":{"title":"P Null","type":"number"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"title":"Confidence"},"span":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"default":null,"title":"Span"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Text"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Number read as money: the stated ISO 4217 code, null when unstated.","title":"Currency"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Duration converted to this unit.","title":"Unit"},"candidates":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExtractionCandidate"},"type":"array"},{"type":"null"}],"default":null,"title":"Candidates"}},"required":["type","p_null"],"title":"OneValueAnswer","type":"object"},"ExtractionsResponse":{"properties":{"answers":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/OneValueAnswer"},{"$ref":"#/components/schemas/ListAnswer"}]},"title":"Answers","type":"object"},"model":{"title":"Model","type":"string"},"truncated":{"description":"Always false: a state over the limit is a 413.","title":"Truncated","type":"boolean"},"usage":{"$ref":"#/components/schemas/ExtractionsUsage"},"state_text":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"State Text"}},"required":["answers","model","truncated","usage"],"title":"ExtractionsResponse","type":"object"},"ExtractionsErrorDetail":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"ExtractionsErrorDetail","type":"object"},"ExtractionsErrorBody":{"description":"OpenRouter's error body.","properties":{"error":{"$ref":"#/components/schemas/ExtractionsErrorDetail"}},"required":["error"],"title":"ExtractionsErrorBody","type":"object"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"Levanto API key. Send `Authorization: Bearer lv_live_...`.","scheme":"bearer"}}}}