Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server’s own CPU, up to 16 texts per request. The answer is then under the key decision.
POST
/
decide
curl --request POST \ --url https://api.tokz.dev/decide \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "inputs": "I was charged twice for my May invoice and the app keeps logging me out.", "decisions": { "queue": { "type": "choice", "question": "Which team should handle this ticket?", "options": [ "billing", "technical", "account", "sales" ] }, "urgent": { "type": "bool" } }}'
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Tokz Labs","description":"Small, fast models for AI agents: the Decisions API and the open OpenDecision models.","colors":{"primary":"#22a33a","light":"#44e05b","dark":"#1a6a2c"},"favicon":"https://mintcdn.com/tokz/7mjmCaA7pLrjEUXw/favicon.ico?fit=max\u0026auto=format\u0026n=7mjmCaA7pLrjEUXw\u0026q=85\u0026s=d8047f5a69e1e5095c2b45938134272d","navbar":{"links":[{"href":"https://github.com/tokz-labs","label":"Benchmarks"}],"primary":{"type":"button","label":"Get an API key","href":"https://app.tokz.dev/login"}},"footer":{"socials":{"github":"https://github.com/tokz-labs"}},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"tokz","hasAudioNarration":false,"actualSubdomain":"tokz","customDomains":["docs.tokz.dev"],"gitSource":{"type":"github","owner":"tokz-labs","repo":"platform","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"latestBuiltDeploymentHistoryId":"6ae5ea02302fef4badce04c9","collectionId":"385800de-2be6-4780-b164-724a465d1c95","liveDeploymentHistoryId":"6ae5ea02302fef4badce04c9","schemaVersion":"v3"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6aeddb9504d689b727c90b16","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"API reference","count":6},{"language":"default","tag":"Decisions","count":3},{"language":"default","tag":"Advanced","count":2},{"language":"default","tag":"Decisions API","count":2},{"language":"default","tag":"Getting started","count":2},{"language":"default","tag":"SDKs","count":2},{"language":"default","tag":"Fine tunes","count":2},{"language":"default","tag":"Operations","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/decisions/answer-typed-decisions-about-texts","slug":"/api-reference/decisions/answer-typed-decisions-about-texts","pageMetadata":{"title":"Answer typed decisions about texts","description":"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server's own CPU, up to 16 texts per request. The answer is then under the key decision.","deprecated":null,"version":null,"openapi":"/openapi.json post /decide","href":"/api-reference/decisions/answer-typed-decisions-about-texts","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server’s own CPU, up to 16 texts per request. The answer is then under the key decision.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Answer typed decisions about texts","description":"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server's own CPU, up to 16 texts per request. The answer is then under the key decision.","deprecated":null,"version":null,"openapi":"/openapi.json post /decide","href":"/api-reference/decisions/answer-typed-decisions-about-texts","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"decide","summary":"Answer typed decisions about texts","description":"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server's own CPU, up to 16 texts per request. The answer is then under the key decision.","tags":["Decisions"],"requestBody":"94fbad6b-aa3f-427c-a5b9-b584247fdb9d","responses":{"200":"ebdda4f4-b7d2-4063-90b2-563e3e952c4a","400":"1c373b36-d8d4-4edc-a799-0093d390a4e0","401":"bd0b8d30-b14e-4bb4-8378-f117058f2b90","402":"7fe25243-c62e-4f49-ba5e-ad354bbd1417","413":"a3f46993-8bc7-4be8-aa28-3427d89f398e","429":"56486666-2c7d-44ce-a0f8-742dc6d92157","502":"0f2f6259-9c4a-496a-b73a-00516171b1b2","503":"0c861b43-16cf-41fc-a405-835161214816"},"method":"post","type":"path","servers":["2e8bac87-bd62-49bb-ade7-6537f995eb4e","7ff38911-110a-404d-8d41-c1fff49c2883"],"security":["5964a203-2c3f-456a-af79-a4cab44ec8cb"],"path":"/decide","baseUrlOptions":["https://api.tokz.dev","http://127.0.0.1:3999"],"title":"Answer typed decisions about texts","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["inputs"],"additionalProperties":false,"properties":{"inputs":{"oneOf":[{"type":"string","description":"One text or up to 64, each at most 20,000 characters. A fine tune takes up to 16.","maxLength":20000,"minLength":1,"isRequired":true,"uniqueKey":"inputs.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"string","minLength":1,"maxLength":20000,"uniqueKey":"inputs.oneOf.1.items.[INDEX]","typeLabel":"string"},"description":"One text or up to 64, each at most 20,000 characters. A fine tune takes up to 16.","maxItems":64,"minItems":1,"isRequired":true,"uniqueKey":"inputs.oneOf.1","typeLabel":"string[]"}],"isRequired":true,"uniqueKey":"inputs","typeLabel":"string | string[]"},"model":{"type":"string","description":"A catalog model (opendecision-small, opendecision-large-packed, opendecision-large), or the name of a fine tune your organization owns.","default":"opendecision-large-packed","uniqueKey":"model","typeLabel":"string"},"decisions":{"type":"object","minProperties":1,"maxProperties":16,"additionalProperties":{"type":"object","required":["type"],"additionalProperties":false,"description":"One question. choice and multilabel need options (2 to 256, unique ids); bool and score take none.","properties":{"type":{"type":"string","enum":["choice","multilabel","bool","score"],"isRequired":true,"uniqueKey":"decisions.additionalProperties.type","typeLabel":"enum\u003cstring>"},"question":{"type":"string","maxLength":1000,"uniqueKey":"decisions.additionalProperties.question","typeLabel":"string"},"options":{"type":"array","minItems":2,"maxItems":256,"items":{"oneOf":[{"type":"string","maxLength":500,"minLength":1,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"object","required":["id"],"properties":{"id":{"type":"string","minLength":1,"maxLength":200,"isRequired":true,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.id","typeLabel":"string"},"name":{"oneOf":[{"type":"string","maxLength":500,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.name.oneOf.0","typeLabel":"string"},{"type":"null","maxLength":500,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.name.oneOf.1","typeLabel":"null"}],"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.name","typeLabel":"string | null"},"description":{"oneOf":[{"type":"string","maxLength":2000,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.description.oneOf.0","typeLabel":"string"},{"type":"null","maxLength":2000,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.description.oneOf.1","typeLabel":"null"}],"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1.description","typeLabel":"string | null"}},"additionalProperties":false,"uniqueKey":"decisions.additionalProperties.options.items.[INDEX].oneOf.1","typeLabel":"object"}],"uniqueKey":"decisions.additionalProperties.options.items.[INDEX]","typeLabel":"string | object"},"uniqueKey":"decisions.additionalProperties.options","typeLabel":"(string | object)[]"},"threshold":{"type":"number","exclusiveMinimum":0,"exclusiveMaximum":1,"default":0.5,"description":"multilabel only: an option is selected when its probability reaches this.","uniqueKey":"decisions.additionalProperties.threshold","typeLabel":"number"},"low":{"type":"integer","default":0,"description":"score only.","uniqueKey":"decisions.additionalProperties.low","typeLabel":"integer"},"high":{"type":"integer","default":5,"description":"score only.","uniqueKey":"decisions.additionalProperties.high","typeLabel":"integer"},"step":{"type":"integer","minimum":1,"default":1,"description":"score only. The range must hold 2 to 256 values.","uniqueKey":"decisions.additionalProperties.step","typeLabel":"integer"}},"uniqueKey":"decisions.additionalProperties","typeLabel":"object"},"description":"Questions keyed by name, 1 to 16 per request. Required for a catalog model, and refused for a fine tune, which already knows its question and labels.","uniqueKey":"decisions","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"supportTicket":{"title":"supportTicket","value":{"inputs":"I was charged twice for my May invoice and the app keeps logging me out.","decisions":{"queue":{"type":"choice","question":"Which team should handle this ticket?","options":["billing","technical","account","sales"]},"urgent":{"type":"bool"}}}},"fineTune":{"title":"fineTune","value":{"model":"support-triage","inputs":"I was charged twice for my May invoice."}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"ebdda4f4-b7d2-4063-90b2-563e3e952c4a":{"description":"One object per input, keyed by decision name. A fine tune uses the fixed key decision.","content":{"application/json":{"schema":{"type":"object","required":["id","model","results","usage"],"properties":{"id":{"type":"string","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"model":{"type":"string","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"results":{"type":"array","items":{"type":"object","additionalProperties":{"type":"object","required":["type","best","selected","policy","value"],"properties":{"type":{"type":"string","enum":["choice","multilabel","bool","score"],"isRequired":true,"uniqueKey":"results.items.[INDEX].additionalProperties.type","typeLabel":"enum\u003cstring>"},"best":{"type":"string","description":"The highest-probability option.","isRequired":true,"uniqueKey":"results.items.[INDEX].additionalProperties.best","typeLabel":"string"},"selected":{"type":"array","items":{"type":"string","uniqueKey":"results.items.[INDEX].additionalProperties.selected.items.[INDEX]","typeLabel":"string"},"description":"multilabel: every option whose value reaches the threshold. Otherwise the best option.","isRequired":true,"uniqueKey":"results.items.[INDEX].additionalProperties.selected","typeLabel":"string[]"},"policy":{"type":"object","additionalProperties":{"type":"number","uniqueKey":"results.items.[INDEX].additionalProperties.policy.additionalProperties","typeLabel":"number"},"description":"Distribution over the options; sums to 1.","isRequired":true,"uniqueKey":"results.items.[INDEX].additionalProperties.policy","typeLabel":"object"},"value":{"type":"object","additionalProperties":{"type":"number","uniqueKey":"results.items.[INDEX].additionalProperties.value.additionalProperties","typeLabel":"number"},"description":"Per-option probability that the option is correct.","isRequired":true,"uniqueKey":"results.items.[INDEX].additionalProperties.value","typeLabel":"object"},"score":{"oneOf":[{"type":"number","description":"score only: the expected value.","uniqueKey":"results.items.[INDEX].additionalProperties.score.oneOf.0","typeLabel":"number"},{"type":"null","description":"score only: the expected value.","uniqueKey":"results.items.[INDEX].additionalProperties.score.oneOf.1","typeLabel":"null"}],"uniqueKey":"results.items.[INDEX].additionalProperties.score","typeLabel":"number | null"}},"uniqueKey":"results.items.[INDEX].additionalProperties","typeLabel":"object"},"uniqueKey":"results.items.[INDEX]","typeLabel":"object"},"description":"One object per input, in order, keyed by decision name. A fine tune uses the fixed key decision.","isRequired":true,"uniqueKey":"results","typeLabel":"object[]"},"usage":{"type":"object","required":["billed_tokens","cost_usd"],"properties":{"billed_tokens":{"type":"integer","isRequired":true,"uniqueKey":"usage.billed_tokens","typeLabel":"integer"},"cost_usd":{"type":"number","description":"billed_tokens at the model's list price.","isRequired":true,"uniqueKey":"usage.cost_usd","typeLabel":"number"}},"isRequired":true,"uniqueKey":"usage","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"\u003cstring>","model":"\u003cstring>","results":[{}],"usage":{"billed_tokens":123,"cost_usd":123}}}},"exampleType":"generated"}},"exampleType":"generated"},"1c373b36-d8d4-4edc-a799-0093d390a4e0":{"description":"The request body is malformed or a field is out of range.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"bd0b8d30-b14e-4bb4-8378-f117058f2b90":{"description":"Missing, malformed, revoked, or incorrect API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"7fe25243-c62e-4f49-ba5e-ad354bbd1417":{"description":"The account behind the key has no remaining prepaid credits. Add credits and retry; the request was not processed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["insufficient_credits"],"isRequired":true,"uniqueKey":"error","typeLabel":"enum\u003cstring>"},"balance":{"type":"integer","description":"Remaining balance in cents (0 when exhausted).","isRequired":true,"uniqueKey":"balance","typeLabel":"integer"}},"required":["error","balance"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"insufficient_credits","balance":123}}},"exampleType":"generated"}},"exampleType":"generated"},"a3f46993-8bc7-4be8-aa28-3427d89f398e":{"description":"The request body exceeds 4 MiB, or (input_too_large) a text needs more memory than a hosted fine tune with this many labels allows. Nothing was charged.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"56486666-2c7d-44ce-a0f8-742dc6d92157":{"description":"Too many requests for this API key, or (decide_org_busy) too many texts in progress on hosted fine tunes for this organization. Nothing was charged.","headers":{"Retry-After":{"description":"Seconds to wait before sending again. Present on most refusals of a fine tune.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"0f2f6259-9c4a-496a-b73a-00516171b1b2":{"description":"The model service did not answer. Nothing was charged; retry.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"0c861b43-16cf-41fc-a405-835161214816":{"description":"The model service or hosted fine tunes are busy (decide_busy), a fine tune is loading or cannot load (model_unavailable), Fine Tune is off (fine_tune_off), or the model service is not available on this deployment (decide_unavailable). Nothing was charged.","headers":{"Retry-After":{"description":"Seconds to wait before sending again. Present on most refusals of a fine tune.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"A code or a short message. Never contains payload content.","isRequired":true,"uniqueKey":"error","typeLabel":"string"},"message":{"type":"string","description":"What went wrong and what to do next, when the API has a sentence for it.","uniqueKey":"message","typeLabel":"string"},"requestId":{"type":"string","uniqueKey":"requestId","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":"\u003cstring>","message":"\u003cstring>","requestId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"5964a203-2c3f-456a-af79-a4cab44ec8cb":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Your API key: `Authorization: Bearer tokz_live_\u003cid>_\u003csecret>`. Only a SHA-256 hash of the secret is stored.","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"2e8bac87-bd62-49bb-ade7-6537f995eb4e":{"url":"https://api.tokz.dev","description":"Production"},"7ff38911-110a-404d-8d41-c1fff49c2883":{"url":"http://127.0.0.1:3999","description":"Local dev (dev:pglite)"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"Your API key: `Authorization: Bearer tokz_live_\u003cid>_\u003csecret>`. Only a SHA-256 hash of the secret is stored.","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Your API key: `Authorization: Bearer tokz_live_\u003cid>_\u003csecret>`. Only a SHA-256 hash of the secret is stored.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"openapi.json"},"subdomain":"tokz","siteName":"Tokz Labs","title":"Answer typed decisions about texts - Tokz Labs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-06T13:52:26.313Z","originalFileLocation":"api-reference/decisions/answer-typed-decisions-about-texts.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server\u0026#x27;s own CPU, up to 16 texts per request. The answer is then under the key decision.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Tokz Labs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Answer typed decisions about texts - Tokz Labs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server\u0026#x27;s own CPU, up to 16 texts per request. The answer is then under the key decision.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Tokz Labs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://tokz.mintlify.site/_mintlify/api/og/v2?division=Decisions\u0026amp;title=Answer+typed+decisions+about+texts\u0026amp;description=Asks+one+or+more+typed+questions+%28choice%2C+multilabel%2C+bool%2C+score%29+about+up+to+64+texts+and+returns%2C+per+text+and+question%2C+the+best+option%2C+the+selected+option\u0026amp;theme=83f64cfad873140bf3f7ed7a\u0026amp;signature=590c9338bdcfe2a37e4b6bffdb84cd2525c2c4bf03439649c5cc780bc56cee43\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Answer typed decisions about texts - Tokz Labs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server\u0026#x27;s own CPU, up to 16 texts per request. The answer is then under the key decision.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://tokz.mintlify.site/_mintlify/api/og/v2?division=Decisions\u0026amp;title=Answer+typed+decisions+about+texts\u0026amp;description=Asks+one+or+more+typed+questions+%28choice%2C+multilabel%2C+bool%2C+score%29+about+up+to+64+texts+and+returns%2C+per+text+and+question%2C+the+best+option%2C+the+selected+option\u0026amp;theme=83f64cfad873140bf3f7ed7a\u0026amp;signature=590c9338bdcfe2a37e4b6bffdb84cd2525c2c4bf03439649c5cc780bc56cee43\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/tokz/_6_DsYTrox7oU58O/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Tokz Labs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#22a33a\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/decisions/answer-typed-decisions-about-texts.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.tokz.dev/#organization\",\"name\":\"Tokz Labs\",\"url\":\"https://docs.tokz.dev\"},{\"@type\":\"WebSite\",\"@id\":\"https://docs.tokz.dev#website\",\"name\":\"Tokz Labs\",\"url\":\"https://docs.tokz.dev\",\"publisher\":{\"@id\":\"https://docs.tokz.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts#webpage\",\"url\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts\",\"name\":\"Answer typed decisions about texts\",\"description\":\"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server's own CPU, up to 16 texts per request. The answer is then under the key decision.\",\"dateModified\":\"2026-11-06T13:52:26.313Z\",\"isPartOf\":{\"@id\":\"https://docs.tokz.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API reference\",\"item\":\"https://docs.tokz.dev/api-reference/operations/liveness-and-readiness\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Answer typed decisions about texts\",\"item\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts#apireference\",\"headline\":\"Answer typed decisions about texts\",\"name\":\"Answer typed decisions about texts\",\"description\":\"Asks one or more typed questions (choice, multilabel, bool, score) about up to 64 texts and returns, per text and question, the best option, the selected options, a probability distribution over the options, and for scores the expected value. This runs an OpenDecision model: the text is sent to a Tokz-run model service. It is not stored or logged; only counters are kept. Billed per token at the price of the chosen model, from the prepaid credit balance, and only when the request succeeds. Give the name of a fine tune your organization owns as model and leave out decisions to run that model on the API server's own CPU, up to 16 texts per request. The answer is then under the key decision.\",\"url\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts\",\"mainEntityOfPage\":{\"@id\":\"https://docs.tokz.dev/api-reference/decisions/answer-typed-decisions-about-texts#webpage\"},\"dateModified\":\"2026-11-06T13:52:26.313Z\",\"publisher\":{\"@id\":\"https://docs.tokz.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.tokz.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Tokz Labs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Tokz Labs","nav":{"global":null,"groups":[{"group":"Getting started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"}]},{"group":"Decisions API","pages":[{"title":"Decisions API","href":"/decisions"},{"title":"Fine Tune","href":"/fine-tune"}]},{"group":"SDKs","pages":[{"title":"TypeScript SDK","href":"/sdk/typescript"},{"title":"Python SDK","href":"/sdk/python"}]},{"group":"Advanced","pages":[{"title":"Billing","href":"/billing"},{"title":"Troubleshooting","href":"/troubleshooting"}]},{"group":"API reference","pages":[{"group":"Operations","pages":[{"title":"Liveness and readiness","description":"Reports process liveness and database reachability. Unauthenticated.","deprecated":null,"version":null,"openapi":"/openapi.json get /health","href":"/api-reference/operations/liveness-and-readiness"}]},{"group":"Decisions","pages":[{"title":"Answer typed decisions about texts","deprecated":null,"version":null,"openapi":"/openapi.json post /decide","href":"/api-reference/decisions/answer-typed-decisions-about-texts"},{"title":"Decision models and prices","description":"The models behind /decide with their price per million billed tokens and the request limits. Unauthenticated and cacheable.","deprecated":null,"version":null,"openapi":"/openapi.json get /decide/models","href":"/api-reference/decisions/decision-models-and-prices"},{"title":"Decision usage for the authenticated key","deprecated":null,"version":null,"openapi":"/openapi.json get /decide/usage","href":"/api-reference/decisions/decision-usage-for-the-authenticated-key"}]},{"group":"Fine tunes","pages":[{"title":"List a fine tune's model files","deprecated":null,"version":null,"openapi":"/openapi.json get /fine-tunes/{name}/bundle","href":"/api-reference/fine-tunes/list-a-fine-tunes-model-files"},{"title":"Download one of a fine tune's model files","deprecated":null,"version":null,"openapi":"/openapi.json get /fine-tunes/{name}/bundle/{file}","href":"/api-reference/fine-tunes/download-one-of-a-fine-tunes-model-files"}]}]}]},"basePath":"","title":"Answer typed decisions about texts - Tokz Labs","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-i2a3QZ8E.js","utils-ChLwp8m0.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DRktVTDc.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CA2pEs4T.js","snippetPresets-ClQ6XrKD.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Ct_Lv36y.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-Cn2PYw9e.js","shallow-rkyymjXQ.js","getApiPlaygroundDisplay-BB9vkXtE.js","CodeSnippet-Bm5RU7m1.js","CodeSnippets-BgU9Deuz.js","Page-BUDYNlhG.js","getPastedJson-BD-6NNum.js","icon-8Z6tud2e.js","MethodPill-Tuzr4g3V.js","DuplicateIcon-0ceWFYhN.js","createIcon-FBXow_ST.js","DynamicMarkdown-CD8713Yy.js","SectionHeading-7zgzQbH-.js","axios-vUo_bRtp.js","Markdown-D7Ofw1oz.js","clsx-eKJ4rcii.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CwjSCXIK.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-9EK5IAXV.js"]}