Runs a query and streams the answer as Server-Sent Events.
Saving. With model_id and no conversation_id, a new conversation is created and the
question and answer are saved to it; its ID is in the complete event. Pass that
conversation_id (with the same model_id) to continue the conversation. Without
model_id, conversation_id is null.
Stream format. Each event is an event: <type> line followed by a data: <JSON> line.
The whole answer arrives in a single message event, and the stream ends after the
complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive)
are comments sent while waiting and should be ignored.
Server-Sent Events stream. See the event table above.
The response is of type string.
⌘I
{"docsConfig":{"theme":"willow","$schema":"https://mintlify.com/schema.json","name":"4Minds","colors":{"primary":"#0A0050","light":"#D2EA47","dark":"#80AEFF"},"logo":{"light":"https://mintcdn.com/4minds-e9525117/n55t5tM9OTD8RZz3/images/fullLogoBlack.svg?fit=max\u0026auto=format\u0026n=n55t5tM9OTD8RZz3\u0026q=85\u0026s=de05cef735fb33fa8abd7ec4a3b7e992","dark":"https://mintcdn.com/4minds-e9525117/n55t5tM9OTD8RZz3/images/fullLogoWhite.svg?fit=max\u0026auto=format\u0026n=n55t5tM9OTD8RZz3\u0026q=85\u0026s=fa0befc8a3557581e6e5607c6c09e77e"},"favicon":{"light":"https://mintcdn.com/4minds-e9525117/n55t5tM9OTD8RZz3/images/logoBlackNoPadding.svg?fit=max\u0026auto=format\u0026n=n55t5tM9OTD8RZz3\u0026q=85\u0026s=af25ea94e6530d7c568a88c4fb665c65","dark":"https://mintcdn.com/4minds-e9525117/n55t5tM9OTD8RZz3/images/logoWhiteNoPadding.svg?fit=max\u0026auto=format\u0026n=n55t5tM9OTD8RZz3\u0026q=85\u0026s=41ee2a402a0d7a1a1d946029979acaa4"},"background":{"color":{"light":"#E9EFFF","dark":"#0C0C0C"}},"seo":{"metatags":{"google-site-verification":"2ole44wh7D3TkErjYO6eqaku3pjF0TpC4L9fG6nv0f8"}},"fonts":{"heading":{"family":"Roboto"},"body":{"family":"Open Sans"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"4minds-e9525117","hasAudioNarration":false,"actualSubdomain":"4minds-e9525117","customDomains":["docs.4minds.ai"],"gitSource":{"type":"github","owner":"4minds-ai","repo":"4minds-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aebb9705d1492e9eae71086","collectionId":"e8d44de6-f57e-4a9b-abde-38a9ea681cfd","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aebb9705d1492e9eae71086"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aebde2ece556a2994de7789","clientVersion":"0.0.4067","searchFilterCounts":[{"language":"default","tag":"4Minds Features","count":27},{"language":"default","tag":"Developer Tools","count":18},{"language":"default","tag":"4Minds API","count":17},{"language":"default","tag":"4Minds API Endpoints","count":16},{"language":"default","tag":"Integrations","count":13},{"language":"default","tag":"SYMI","count":7},{"language":"default","tag":"Datasets","count":6},{"language":"default","tag":"Conversations","count":5},{"language":"default","tag":"Intro","count":4},{"language":"default","tag":"Models","count":4}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":"vite-origin","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}],"googleFontsInlined":true},"customCss":[{"filePath":"custom.css","content":".nav-logo{height:1.75rem!important;margin-left:-0.48rem!important}[class*=\"powered-by\"],[class*=\"PoweredBy\"],[class*=\"poweredBy\"],footer a[href*=\"mintlify.com\"],footer a[href*=\"mintlify\"]{display:none!important;visibility:hidden!important;opacity:0!important;height:0!important;width:0!important;overflow:hidden!important}#custom-legal-links a,#custom-legal-links .separator{margin-right:8px}#custom-legal-links .separator{margin-left:8px;opacity:0.6}footer [class*=\"legal\"]>span:first-child,footer [class*=\"legal\"]>div:first-child,footer h3,footer h4,footer h5{display:none!important}footer,footer *,footer::before,footer::after,footer *::before,footer *::after,[class*=\"footer\"],[class*=\"footer\"] *,[class*=\"footer\"]::before,[class*=\"footer\"]::after,[class*=\"footer\"] *::before,[class*=\"footer\"] *::after{border:none!important;border-top:none!important;border-bottom:none!important;border-left:none!important;border-right:none!important}footer hr,[class*=\"footer\"] hr{display:none!important}footer,footer>div,footer [class*=\"footer\"]{display:flex!important;flex-direction:column!important;align-items:center!important;width:100%!important;gap:5px!important}footer [class*=\"legal\"],footer nav,footer ul{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;gap:80px!important;flex-wrap:nowrap!important;white-space:nowrap!important;list-style:none!important;padding:0!important;margin:0!important;width:auto!important;max-width:100%!important;overflow-x:auto!important}footer [class*=\"legal\"] a,footer nav a,footer ul a,footer a[href*=\"4minds.ai\"]{display:inline-block!important;margin:0!important;padding:0!important;white-space:nowrap!important}footer [class*=\"legal\"] a:not(:last-child)::after,footer nav a:not(:last-child)::after,footer ul li:not(:last-child)::after,footer a[href*=\"4minds.ai\"]:not(:last-of-type)::after{content:\"\"!important;margin-left:0!important;margin-right:0!important}footer [class*=\"copyright\"],footer p:last-child,footer div:last-child{display:block!important;text-align:center!important;padding:10px 0!important;margin-top:5px!important;border:none!important;color:inherit!important;font-size:14px!important;width:100%!important;order:999!important}"}],"page":{"pagePath":"api-reference/inference/run-an-inference-query-streaming-sse","slug":"/api-reference/inference/run-an-inference-query-streaming-sse","pageMetadata":{"title":"Run an inference query (streaming SSE)","description":"Runs a query and streams the answer as Server-Sent Events.\n\n**Saving.** With `model_id` and no `conversation_id`, a new conversation is created and the\nquestion and answer are saved to it; its ID is in the `complete` event. Pass that\n`conversation_id` (with the same `model_id`) to continue the conversation. Without\n`model_id`, `conversation_id` is `null`.\n\n**Stream format.** Each event is an `event: \u003ctype>` line followed by a `data: \u003cJSON>` line.\nThe whole answer arrives in a single `message` event, and the stream ends after the\n`complete` event (there is no `[DONE]` marker). Lines starting with `:` (e.g. `: keepalive`)\nare comments sent while waiting and should be ignored.\n\n| Event | When | Data fields |\n|---|---|---|\n| `context` | Knowledge-base chunks were used | `type`, `context`, `chunks` (`chunk_id`, `document_title`, `score`), `conversation_id` |\n| `web_sources` | Web search was used | `type`, `sources` (`title`, `url`, `snippet`, `relevance_score`), `total_sources`, `conversation_id` |\n| `image_generation` | An image was generated | `type`, `content`, `image_url`, `blob_path`, `generation_id`, `generation_time_seconds` |\n| `reasoning` | With `model_id` | `type`, `path` |\n| `message` | Always | `type`, `content` (the full answer) |\n| `complete` | Always, last | `type`, `reasoning_path`, `context_chunks`, `total_tokens`, `processing_time_ms`, `finish_reason`, `conversation_id` |\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/inference","href":"/api-reference/inference/run-an-inference-query-streaming-sse","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n strong: \"strong\",\n table: \"table\",\n tbody: \"tbody\",\n td: \"td\",\n th: \"th\",\n thead: \"thead\",\n tr: \"tr\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Runs a query and streams the answer as Server-Sent Events.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Saving.\"\n }), \" With \", _jsx(_components.code, {\n children: \"model_id\"\n }), \" and no \", _jsx(_components.code, {\n children: \"conversation_id\"\n }), \", a new conversation is created and the\\nquestion and answer are saved to it; its ID is in the \", _jsx(_components.code, {\n children: \"complete\"\n }), \" event. Pass that\\n\", _jsx(_components.code, {\n children: \"conversation_id\"\n }), \" (with the same \", _jsx(_components.code, {\n children: \"model_id\"\n }), \") to continue the conversation. Without\\n\", _jsx(_components.code, {\n children: \"model_id\"\n }), \", \", _jsx(_components.code, {\n children: \"conversation_id\"\n }), \" is \", _jsx(_components.code, {\n children: \"null\"\n }), \".\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Stream format.\"\n }), \" Each event is an \", _jsx(_components.code, {\n children: \"event: \u003ctype>\"\n }), \" line followed by a \", _jsx(_components.code, {\n children: \"data: \u003cJSON>\"\n }), \" line.\\nThe whole answer arrives in a single \", _jsx(_components.code, {\n children: \"message\"\n }), \" event, and the stream ends after the\\n\", _jsx(_components.code, {\n children: \"complete\"\n }), \" event (there is no \", _jsx(_components.code, {\n children: \"[DONE]\"\n }), \" marker). Lines starting with \", _jsx(_components.code, {\n children: \":\"\n }), \" (e.g. \", _jsx(_components.code, {\n children: \": keepalive\"\n }), \")\\nare comments sent while waiting and should be ignored.\"]\n }), \"\\n\", _jsxs(_components.table, {\n children: [_jsx(_components.thead, {\n children: _jsxs(_components.tr, {\n children: [_jsx(_components.th, {\n children: \"Event\"\n }), _jsx(_components.th, {\n children: \"When\"\n }), _jsx(_components.th, {\n children: \"Data fields\"\n })]\n })\n }), _jsxs(_components.tbody, {\n children: [_jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"context\"\n })\n }), _jsx(_components.td, {\n children: \"Knowledge-base chunks were used\"\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"context\"\n }), \", \", _jsx(_components.code, {\n children: \"chunks\"\n }), \" (\", _jsx(_components.code, {\n children: \"chunk_id\"\n }), \", \", _jsx(_components.code, {\n children: \"document_title\"\n }), \", \", _jsx(_components.code, {\n children: \"score\"\n }), \"), \", _jsx(_components.code, {\n children: \"conversation_id\"\n })]\n })]\n }), _jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"web_sources\"\n })\n }), _jsx(_components.td, {\n children: \"Web search was used\"\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"sources\"\n }), \" (\", _jsx(_components.code, {\n children: \"title\"\n }), \", \", _jsx(_components.code, {\n children: \"url\"\n }), \", \", _jsx(_components.code, {\n children: \"snippet\"\n }), \", \", _jsx(_components.code, {\n children: \"relevance_score\"\n }), \"), \", _jsx(_components.code, {\n children: \"total_sources\"\n }), \", \", _jsx(_components.code, {\n children: \"conversation_id\"\n })]\n })]\n }), _jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"image_generation\"\n })\n }), _jsx(_components.td, {\n children: \"An image was generated\"\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"content\"\n }), \", \", _jsx(_components.code, {\n children: \"image_url\"\n }), \", \", _jsx(_components.code, {\n children: \"blob_path\"\n }), \", \", _jsx(_components.code, {\n children: \"generation_id\"\n }), \", \", _jsx(_components.code, {\n children: \"generation_time_seconds\"\n })]\n })]\n }), _jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"reasoning\"\n })\n }), _jsxs(_components.td, {\n children: [\"With \", _jsx(_components.code, {\n children: \"model_id\"\n })]\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"path\"\n })]\n })]\n }), _jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"message\"\n })\n }), _jsx(_components.td, {\n children: \"Always\"\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"content\"\n }), \" (the full answer)\"]\n })]\n }), _jsxs(_components.tr, {\n children: [_jsx(_components.td, {\n children: _jsx(_components.code, {\n children: \"complete\"\n })\n }), _jsx(_components.td, {\n children: \"Always, last\"\n }), _jsxs(_components.td, {\n children: [_jsx(_components.code, {\n children: \"type\"\n }), \", \", _jsx(_components.code, {\n children: \"reasoning_path\"\n }), \", \", _jsx(_components.code, {\n children: \"context_chunks\"\n }), \", \", _jsx(_components.code, {\n children: \"total_tokens\"\n }), \", \", _jsx(_components.code, {\n children: \"processing_time_ms\"\n }), \", \", _jsx(_components.code, {\n children: \"finish_reason\"\n }), \", \", _jsx(_components.code, {\n children: \"conversation_id\"\n })]\n })]\n })]\n })]\n })]\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":"Run an inference query (streaming SSE)","description":"Runs a query and streams the answer as Server-Sent Events.\n\n**Saving.** With `model_id` and no `conversation_id`, a new conversation is created and the\nquestion and answer are saved to it; its ID is in the `complete` event. Pass that\n`conversation_id` (with the same `model_id`) to continue the conversation. Without\n`model_id`, `conversation_id` is `null`.\n\n**Stream format.** Each event is an `event: \u003ctype>` line followed by a `data: \u003cJSON>` line.\nThe whole answer arrives in a single `message` event, and the stream ends after the\n`complete` event (there is no `[DONE]` marker). Lines starting with `:` (e.g. `: keepalive`)\nare comments sent while waiting and should be ignored.\n\n| Event | When | Data fields |\n|---|---|---|\n| `context` | Knowledge-base chunks were used | `type`, `context`, `chunks` (`chunk_id`, `document_title`, `score`), `conversation_id` |\n| `web_sources` | Web search was used | `type`, `sources` (`title`, `url`, `snippet`, `relevance_score`), `total_sources`, `conversation_id` |\n| `image_generation` | An image was generated | `type`, `content`, `image_url`, `blob_path`, `generation_id`, `generation_time_seconds` |\n| `reasoning` | With `model_id` | `type`, `path` |\n| `message` | Always | `type`, `content` (the full answer) |\n| `complete` | Always, last | `type`, `reasoning_path`, `context_chunks`, `total_tokens`, `processing_time_ms`, `finish_reason`, `conversation_id` |\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/inference","href":"/api-reference/inference/run-an-inference-query-streaming-sse","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/4minds-e9525117/e573413487c50684/custom-footer.js"],"openApiReferenceData":{"operation":{"tags":["Inference"],"summary":"Run an inference query (streaming SSE)","operationId":"runInference","description":"Runs a query and streams the answer as Server-Sent Events.\n\n**Saving.** With `model_id` and no `conversation_id`, a new conversation is created and the\nquestion and answer are saved to it; its ID is in the `complete` event. Pass that\n`conversation_id` (with the same `model_id`) to continue the conversation. Without\n`model_id`, `conversation_id` is `null`.\n\n**Stream format.** Each event is an `event: \u003ctype>` line followed by a `data: \u003cJSON>` line.\nThe whole answer arrives in a single `message` event, and the stream ends after the\n`complete` event (there is no `[DONE]` marker). Lines starting with `:` (e.g. `: keepalive`)\nare comments sent while waiting and should be ignored.\n\n| Event | When | Data fields |\n|---|---|---|\n| `context` | Knowledge-base chunks were used | `type`, `context`, `chunks` (`chunk_id`, `document_title`, `score`), `conversation_id` |\n| `web_sources` | Web search was used | `type`, `sources` (`title`, `url`, `snippet`, `relevance_score`), `total_sources`, `conversation_id` |\n| `image_generation` | An image was generated | `type`, `content`, `image_url`, `blob_path`, `generation_id`, `generation_time_seconds` |\n| `reasoning` | With `model_id` | `type`, `path` |\n| `message` | Always | `type`, `content` (the full answer) |\n| `complete` | Always, last | `type`, `reasoning_path`, `context_chunks`, `total_tokens`, `processing_time_ms`, `finish_reason`, `conversation_id` |\n","requestBody":"e5081ef7-5aee-4036-909d-e2d1c1e02b56","responses":{"200":"2597c6e3-419b-47b5-b419-5c1f6cd621eb","400":"74294c3b-8e0b-403d-a422-71ae12be315e","401":"87cc2fc1-84b1-4f04-83ec-118b6cdf4acc","404":"acaf1f1e-bb23-49c0-a9fa-1f305d7a2aed"},"method":"post","type":"path","servers":["52cd19fe-cca3-4055-8983-37e09f4c8fcf"],"security":["c4f5b703-26ec-49d2-8a81-ae07c451d9ac"],"path":"/api/v1/user/inference","baseUrlOptions":["https://api.4minds.ai"],"title":"Run an inference query (streaming SSE)","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","minLength":1,"description":"The question or instruction.","isRequired":true,"uniqueKey":"query","typeLabel":"string"},"model_id":{"type":"integer","minimum":1,"description":"One of your models, to answer from its knowledge base. Optional; without it, a default model answers.","uniqueKey":"model_id","typeLabel":"integer"},"conversation_id":{"type":"string","format":"uuid","description":"Continue an existing conversation. Requires `model_id`, and the conversation must belong to that model.","uniqueKey":"conversation_id","typeLabel":"string\u003cuuid>"},"inference_engine":{"type":"string","enum":["constellations"],"description":"Omit to use the default engine (SYMI). `constellations` requires `model_id`.","uniqueKey":"inference_engine","typeLabel":"enum\u003cstring>"},"enable_web_search":{"type":"boolean","default":false,"description":"Add live web results to the answer. Only takes effect together with `model_id`.","uniqueKey":"enable_web_search","typeLabel":"boolean"},"image_generation":{"type":"boolean","default":false,"description":"Generate an image from the query. The image link is in the `image_generation` event.","uniqueKey":"image_generation","typeLabel":"boolean"},"image_parameters":{"type":"object","additionalProperties":false,"description":"Only these keys are allowed; any other key returns 400.","properties":{"width":{"type":"integer","minimum":512,"maximum":2048,"uniqueKey":"image_parameters.width","typeLabel":"integer"},"height":{"type":"integer","minimum":512,"maximum":2048,"uniqueKey":"image_parameters.height","typeLabel":"integer"},"num_inference_steps":{"type":"integer","minimum":10,"maximum":100,"uniqueKey":"image_parameters.num_inference_steps","typeLabel":"integer"},"guidance_scale":{"type":"number","minimum":1,"maximum":20,"uniqueKey":"image_parameters.guidance_scale","typeLabel":"number"},"seed":{"type":"integer","uniqueKey":"image_parameters.seed","typeLabel":"integer"}},"uniqueKey":"image_parameters","typeLabel":"object"},"temperature":{"type":"number","minimum":0,"maximum":2,"uniqueKey":"temperature","typeLabel":"number"}},"uniqueKey":"","typeLabel":"object"},"examples":{"simple":{"title":"simple","value":{"query":"What is machine learning?"}},"with_model":{"title":"with_model","value":{"query":"Summarize our onboarding policy.","model_id":3801}},"continue":{"title":"continue","value":{"query":"And the leave policy?","model_id":3801,"conversation_id":"23e856b9-879c-4edb-90ca-55fbe8452103"}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"2597c6e3-419b-47b5-b419-5c1f6cd621eb":{"description":"Server-Sent Events stream. See the event table above.","content":{"text/event-stream":{"schema":{"type":"string","uniqueKey":"","typeLabel":"string"},"example":"event: context\ndata: {\"type\": \"context\", \"context\": \"rag\", \"chunks\": [{\"chunk_id\": \"76111341-56c6-4d1b-8ced-bea9add5699e\", \"document_title\": \"handbook.pdf\", \"score\": 0.63}], \"conversation_id\": \"efeb96cc-bf2a-4c87-b97b-3d953d3fc286\"}\n\nevent: reasoning\ndata: {\"type\": \"reasoning\", \"path\": \"single_hop\"}\n\nevent: message\ndata: {\"type\": \"message\", \"content\": \"The handbook covers onboarding, leave and expense policies.\"}\n\nevent: complete\ndata: {\"type\": \"complete\", \"reasoning_path\": \"single_hop\", \"context_chunks\": 1, \"total_tokens\": 50, \"processing_time_ms\": 15714, \"finish_reason\": \"stop\", \"conversation_id\": \"efeb96cc-bf2a-4c87-b97b-3d953d3fc286\"}\n","examples":{"Example":{"title":"Example","value":"event: context\ndata: {\"type\": \"context\", \"context\": \"rag\", \"chunks\": [{\"chunk_id\": \"76111341-56c6-4d1b-8ced-bea9add5699e\", \"document_title\": \"handbook.pdf\", \"score\": 0.63}], \"conversation_id\": \"efeb96cc-bf2a-4c87-b97b-3d953d3fc286\"}\n\nevent: reasoning\ndata: {\"type\": \"reasoning\", \"path\": \"single_hop\"}\n\nevent: message\ndata: {\"type\": \"message\", \"content\": \"The handbook covers onboarding, leave and expense policies.\"}\n\nevent: complete\ndata: {\"type\": \"complete\", \"reasoning_path\": \"single_hop\", \"context_chunks\": 1, \"total_tokens\": 50, \"processing_time_ms\": 15714, \"finish_reason\": \"stop\", \"conversation_id\": \"efeb96cc-bf2a-4c87-b97b-3d953d3fc286\"}\n"}},"exampleType":"examples"}},"exampleType":"examples"},"74294c3b-8e0b-403d-a422-71ae12be315e":{"description":"An invalid or unsupported field.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"detail":{"oneOf":[{"type":"string","description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"object","required":["type","loc","msg"],"properties":{"type":{"type":"string","examples":["missing"],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].type","typeLabel":"string"},"loc":{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"examples":[["body","model_name"]],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].msg","typeLabel":"string"},"input":{"oneOf":[{}],"uniqueKey":"detail.oneOf.1.items.[INDEX].input","typeLabel":"any"},"ctx":{"type":"object","uniqueKey":"detail.oneOf.1.items.[INDEX].ctx","typeLabel":"object"}},"uniqueKey":"detail.oneOf.1.items.[INDEX]","typeLabel":"object"},"description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.1","typeLabel":"object[]"}],"isRequired":true,"uniqueKey":"detail","typeLabel":"string | object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"missing_query":{"title":"missing_query","value":{"detail":"Missing required field: 'query'"}},"bad_temperature":{"title":"bad_temperature","value":{"detail":"Invalid 'temperature': must be between 0.0 and 2.0"}},"conversation_needs_model":{"title":"conversation_needs_model","value":{"detail":"Invalid 'conversation_id': requires 'model_id'"}},"conversation_other_model":{"title":"conversation_other_model","value":{"detail":"Invalid 'conversation_id': it belongs to a different model"}},"bad_image_parameter":{"title":"bad_image_parameter","value":{"detail":"Invalid 'image_parameters.width': must be between 512 and 2048"}}},"exampleType":"examples"}},"exampleType":"examples"},"87cc2fc1-84b1-4f04-83ec-118b6cdf4acc":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"detail":{"oneOf":[{"type":"string","description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"object","required":["type","loc","msg"],"properties":{"type":{"type":"string","examples":["missing"],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].type","typeLabel":"string"},"loc":{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"examples":[["body","model_name"]],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].msg","typeLabel":"string"},"input":{"oneOf":[{}],"uniqueKey":"detail.oneOf.1.items.[INDEX].input","typeLabel":"any"},"ctx":{"type":"object","uniqueKey":"detail.oneOf.1.items.[INDEX].ctx","typeLabel":"object"}},"uniqueKey":"detail.oneOf.1.items.[INDEX]","typeLabel":"object"},"description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.1","typeLabel":"object[]"}],"isRequired":true,"uniqueKey":"detail","typeLabel":"string | object[]"}},"uniqueKey":"","typeLabel":"object"},"example":{"detail":"Authentication required"},"examples":{"Example":{"title":"Example","value":{"detail":"Authentication required"}}},"exampleType":"examples"}},"exampleType":"examples"},"acaf1f1e-bb23-49c0-a9fa-1f305d7a2aed":{"description":"The model or conversation doesn't exist, or you don't have access to it.","content":{"application/json":{"schema":{"type":"object","required":["detail"],"properties":{"detail":{"oneOf":[{"type":"string","description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"object","required":["type","loc","msg"],"properties":{"type":{"type":"string","examples":["missing"],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].type","typeLabel":"string"},"loc":{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.oneOf.1.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"examples":[["body","model_name"]],"isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","isRequired":true,"uniqueKey":"detail.oneOf.1.items.[INDEX].msg","typeLabel":"string"},"input":{"oneOf":[{}],"uniqueKey":"detail.oneOf.1.items.[INDEX].input","typeLabel":"any"},"ctx":{"type":"object","uniqueKey":"detail.oneOf.1.items.[INDEX].ctx","typeLabel":"object"}},"uniqueKey":"detail.oneOf.1.items.[INDEX]","typeLabel":"object"},"description":"An error message, or a list of validation errors.","isRequired":true,"uniqueKey":"detail.oneOf.1","typeLabel":"object[]"}],"isRequired":true,"uniqueKey":"detail","typeLabel":"string | object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"model":{"title":"model","value":{"detail":"Model with id '999999999' not found"}},"conversation":{"title":"conversation","value":{"detail":"Conversation with id '00000000-0000-0000-0000-000000000000' not found"}},"no_access":{"title":"no_access","value":{"detail":"Not found"}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"c4f5b703-26ec-49d2-8a81-ae07c451d9ac":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Static, non-expiring API key: `Authorization: Bearer \u003cFOURMINDS_API_KEY>`.","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"52cd19fe-cca3-4055-8983-37e09f4c8fcf":{"url":"https://api.4minds.ai"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"Static, non-expiring API key: `Authorization: Bearer \u003cFOURMINDS_API_KEY>`.","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Static, non-expiring API key: `Authorization: Bearer \u003cFOURMINDS_API_KEY>`.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"4minds-e9525117","siteName":"4Minds","title":"Run an inference query (streaming SSE) - 4Minds","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-23T19:58:06.952Z","originalFileLocation":"api-reference/inference/run-an-inference-query-streaming-sse.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=\"Runs a query and streams the answer as Server-Sent Events. Saving. With model_id and no conversation_id, a new conversation is created and the question and answer are saved to it; its ID is in the complete event. Pass that conversation_id (with the same model_id) to continue the conversation. Without model_id, conversation_id is null. Stream format. Each event is an event: line followed by a data: line. The whole answer arrives in a single message event, and the stream ends after the complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive) are comments sent while waiting and should be ignored. | Event | When | Data fields | |---|---|---| | context | Knowledge-base chunks were used | type, context, chunks (chunk_id, document_title, score), conversation_id | | web_sources | Web search was used | type, sources (title, url, snippet, relevance_score), total_sources, conversation_id | | image_generation | An image was generated | type, content, image_url, blob_path, generation_id, generation_time_seconds | | reasoning | With model_id | type, path | | message | Always | type, content (the full answer) | | complete | Always, last | type, reasoning_path, context_chunks, total_tokens, processing_time_ms, finish_reason, conversation_id |\">\u003cmeta data-mint-head name=\"application-name\" content=\"4Minds\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_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/4minds-e9525117/6CsMLCM3QpHT3fB-/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Run an inference query (streaming SSE) - 4Minds\">\u003cmeta data-mint-head property=\"og:description\" content=\"Runs a query and streams the answer as Server-Sent Events. Saving. With model_id and no conversation_id, a new conversation is created and the question and answer are saved to it; its ID is in the complete event. Pass that conversation_id (with the same model_id) to continue the conversation. Without model_id, conversation_id is null. Stream format. Each event is an event: line followed by a data: line. The whole answer arrives in a single message event, and the stream ends after the complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive) are comments sent while waiting and should be ignored. | Event | When | Data fields | |---|---|---| | context | Knowledge-base chunks were used | type, context, chunks (chunk_id, document_title, score), conversation_id | | web_sources | Web search was used | type, sources (title, url, snippet, relevance_score), total_sources, conversation_id | | image_generation | An image was generated | type, content, image_url, blob_path, generation_id, generation_time_seconds | | reasoning | With model_id | type, path | | message | Always | type, content (the full answer) | | complete | Always, last | type, reasoning_path, context_chunks, total_tokens, processing_time_ms, finish_reason, conversation_id |\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"4Minds\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://4minds-e9525117.mintlify.app/_mintlify/api/og/v2?division=Inference\u0026amp;title=Run+an+inference+query+%28streaming+SSE%29\u0026amp;description=Runs+a+query+and+streams+the+answer+as+Server-Sent+Events.%0A%0A**Saving.**+With+%60model_id%60+and+no+%60conversation_id%60%2C+a+new+conversation+is+created+and+the%0Aquestion\u0026amp;theme=a08d550f1325906504303eba\u0026amp;signature=ad524007c8a6a784fc01add6681a9224a05536458d728f3e6725630d83a6fe52\">\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=\"Run an inference query (streaming SSE) - 4Minds\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Runs a query and streams the answer as Server-Sent Events. Saving. With model_id and no conversation_id, a new conversation is created and the question and answer are saved to it; its ID is in the complete event. Pass that conversation_id (with the same model_id) to continue the conversation. Without model_id, conversation_id is null. Stream format. Each event is an event: line followed by a data: line. The whole answer arrives in a single message event, and the stream ends after the complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive) are comments sent while waiting and should be ignored. | Event | When | Data fields | |---|---|---| | context | Knowledge-base chunks were used | type, context, chunks (chunk_id, document_title, score), conversation_id | | web_sources | Web search was used | type, sources (title, url, snippet, relevance_score), total_sources, conversation_id | | image_generation | An image was generated | type, content, image_url, blob_path, generation_id, generation_time_seconds | | reasoning | With model_id | type, path | | message | Always | type, content (the full answer) | | complete | Always, last | type, reasoning_path, context_chunks, total_tokens, processing_time_ms, finish_reason, conversation_id |\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://4minds-e9525117.mintlify.app/_mintlify/api/og/v2?division=Inference\u0026amp;title=Run+an+inference+query+%28streaming+SSE%29\u0026amp;description=Runs+a+query+and+streams+the+answer+as+Server-Sent+Events.%0A%0A**Saving.**+With+%60model_id%60+and+no+%60conversation_id%60%2C+a+new+conversation+is+created+and+the%0Aquestion\u0026amp;theme=a08d550f1325906504303eba\u0026amp;signature=ad524007c8a6a784fc01add6681a9224a05536458d728f3e6725630d83a6fe52\">\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/4minds-e9525117/6CsMLCM3QpHT3fB-/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"4Minds\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0A0050\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"2ole44wh7D3TkErjYO6eqaku3pjF0TpC4L9fG6nv0f8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/inference/run-an-inference-query-streaming-sse.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.4minds.ai/#organization\",\"name\":\"4Minds\",\"url\":\"https://docs.4minds.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/4minds-e9525117/n55t5tM9OTD8RZz3/images/fullLogoBlack.svg?fit=max\u0026auto=format\u0026n=n55t5tM9OTD8RZz3\u0026q=85\u0026s=de05cef735fb33fa8abd7ec4a3b7e992\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.4minds.ai#website\",\"name\":\"4Minds\",\"url\":\"https://docs.4minds.ai\",\"publisher\":{\"@id\":\"https://docs.4minds.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse#webpage\",\"url\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse\",\"name\":\"Run an inference query (streaming SSE)\",\"description\":\"Runs a query and streams the answer as Server-Sent Events. Saving. With model_id and no conversation_id, a new conversation is created and the question and answer are saved to it; its ID is in the complete event. Pass that conversation_id (with the same model_id) to continue the conversation. Without model_id, conversation_id is null. Stream format. Each event is an event: line followed by a data: line. The whole answer arrives in a single message event, and the stream ends after the complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive) are comments sent while waiting and should be ignored. | Event | When | Data fields | |---|---|---| | context | Knowledge-base chunks were used | type, context, chunks (chunk_id, document_title, score), conversation_id | | web_sources | Web search was used | type, sources (title, url, snippet, relevance_score), total_sources, conversation_id | | image_generation | An image was generated | type, content, image_url, blob_path, generation_id, generation_time_seconds | | reasoning | With model_id | type, path | | message | Always | type, content (the full answer) | | complete | Always, last | type, reasoning_path, context_chunks, total_tokens, processing_time_ms, finish_reason, conversation_id |\",\"dateModified\":\"2026-10-23T19:58:06.952Z\",\"isPartOf\":{\"@id\":\"https://docs.4minds.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Developer Tools\",\"item\":\"https://docs.4minds.ai/cloud-shell\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"4Minds API\",\"item\":\"https://docs.4minds.ai/api-overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"4Minds API Endpoints\",\"item\":\"https://docs.4minds.ai/api-reference/models/list-models\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Run an inference query (streaming SSE)\",\"item\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse#apireference\",\"headline\":\"Run an inference query (streaming SSE)\",\"name\":\"Run an inference query (streaming SSE)\",\"description\":\"Runs a query and streams the answer as Server-Sent Events. Saving. With model_id and no conversation_id, a new conversation is created and the question and answer are saved to it; its ID is in the complete event. Pass that conversation_id (with the same model_id) to continue the conversation. Without model_id, conversation_id is null. Stream format. Each event is an event: line followed by a data: line. The whole answer arrives in a single message event, and the stream ends after the complete event (there is no [DONE] marker). Lines starting with : (e.g. : keepalive) are comments sent while waiting and should be ignored. | Event | When | Data fields | |---|---|---| | context | Knowledge-base chunks were used | type, context, chunks (chunk_id, document_title, score), conversation_id | | web_sources | Web search was used | type, sources (title, url, snippet, relevance_score), total_sources, conversation_id | | image_generation | An image was generated | type, content, image_url, blob_path, generation_id, generation_time_seconds | | reasoning | With model_id | type, path | | message | Always | type, content (the full answer) | | complete | Always, last | type, reasoning_path, context_chunks, total_tokens, processing_time_ms, finish_reason, conversation_id |\",\"url\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse\",\"mainEntityOfPage\":{\"@id\":\"https://docs.4minds.ai/api-reference/inference/run-an-inference-query-streaming-sse#webpage\"},\"dateModified\":\"2026-10-23T19:58:06.952Z\",\"publisher\":{\"@id\":\"https://docs.4minds.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.4minds.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"4Minds\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"4Minds","nav":{"global":null,"groups":[{"group":"Intro","icon":"book-open","pages":[{"mode":"wide","title":"What is 4Minds","href":"/introduction"},{"title":"Key Advantages","href":"/key-advantages"},{"title":"Platform Architecture","href":"/platform-architecture"},{"title":"Security and Compliance","href":"/security"}]},{"group":"Getting Started with 4Minds","icon":"rocket","pages":[{"title":"Quick Start Guide","href":"/quickstart"}]},{"group":"Marketplace","icon":"store","pages":[{"group":"AWS","pages":[{"title":"AWS Marketplace: Helm Deployment","href":"/aws-marketplace"}]}]},{"group":"4Minds Features","icon":"sparkles","pages":[{"title":"Manage and Interact with Your Model","href":"/control-center"},{"title":"Explore the Model Dashboard","href":"/models"},{"title":"Evaluate your Model Performance","href":"/evaluations"},{"title":"Manage your Datasets","href":"/datasets"},{"title":"Personas","href":"/persona-configuration"},{"title":"Monitor Your Logs","hidden":true,"href":"/logging"},{"group":"Integrations","pages":[{"title":"Add Integrations \u0026 Data Sources","href":"/integrations"},{"title":"AWS Integrations","href":"/aws-integrations"},{"title":"Amazon RDS","href":"/rds"},{"title":"Amazon Redshift","href":"/redshift"},{"title":"Microsoft Fabric","href":"/microsoft-fabric"},{"title":"Microsoft Foundry","href":"/microsoft-foundry"},{"title":"Microsoft 365 Copilot","href":"/microsoft-365-copilot"},{"title":"Amazon Bedrock","href":"/bedrock"},{"title":"Databricks","href":"/databricks"},{"title":"dbt","href":"/dbt"},{"title":"Gong","href":"/gong"},{"title":"HubSpot","href":"/hubspot"},{"title":"Spacebase","href":"/spacebase"}]},{"title":"Stay Updated with Real-Time Notifications","href":"/notifications"},{"title":"Organize your Teams","href":"/teams"},{"group":"SYMI","pages":[{"title":"SYMI Agentic AI Platform","href":"/symi"},{"title":"Memory","href":"/symi/memory"},{"title":"Persistent Workspace","href":"/symi/persistent-workspace"},{"title":"Skills, Sub-Agents, and Tools","href":"/symi/skills-system"},{"title":"Workspace Mirror","href":"/symi/workspace-mirror"},{"title":"Set up Workspace Mirror","href":"/symi/workspace-mirror-setup"},{"title":"Security \u0026 Isolation","href":"/symi/security-and-isolation"}]}]},{"group":"What's New in 4Minds","icon":"newspaper","pages":[{"title":"Changelog \u0026 Release Notes","href":"/changelog"}]},{"group":"Key Terms and Concepts in 4Minds","icon":"book","pages":[{"title":"Glossary","href":"/glossary"}]},{"group":"Developer Tools","icon":"code","pages":[{"title":"Cloud Shell","href":"/cloud-shell"},{"group":"4Minds API","pages":[{"title":"4Minds API Overview","href":"/api-overview"},{"group":"4Minds API Endpoints","pages":[{"group":"Models","pages":[{"title":"List models","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/model","href":"/api-reference/models/list-models"},{"title":"Create a fine-tuned model","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/model","href":"/api-reference/models/create-a-fine-tuned-model"},{"title":"Get a model","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/model/{model_id}","href":"/api-reference/models/get-a-model"},{"title":"Delete a model","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /api/v1/user/model/{model_id}","href":"/api-reference/models/delete-a-model"}]},{"group":"Conversations","pages":[{"title":"List conversations for a model","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/conversations","href":"/api-reference/conversations/list-conversations-for-a-model"},{"title":"Create a conversation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/conversations","href":"/api-reference/conversations/create-a-conversation"},{"title":"Rename a conversation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json patch /api/v1/user/conversations/{conversation_id}","href":"/api-reference/conversations/rename-a-conversation"},{"title":"Delete a conversation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /api/v1/user/conversations/{conversation_id}","href":"/api-reference/conversations/delete-a-conversation"},{"title":"List messages in a conversation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/conversations/{conversation_id}/messages","href":"/api-reference/conversations/list-messages-in-a-conversation"}]},{"group":"Datasets","pages":[{"title":"List datasets","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/dataset","href":"/api-reference/datasets/list-datasets"},{"title":"Create a dataset from files and/or URLs","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/dataset","href":"/api-reference/datasets/create-a-dataset-from-files-andor-urls"},{"title":"Upload files to an existing dataset","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/dataset/upload","href":"/api-reference/datasets/upload-files-to-an-existing-dataset"},{"title":"Get a dataset","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/dataset/{dataset_id}","href":"/api-reference/datasets/get-a-dataset"},{"title":"Delete a dataset (soft by default)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /api/v1/user/dataset/{dataset_id}","href":"/api-reference/datasets/delete-a-dataset-soft-by-default"},{"title":"List files in a dataset","description":"Returns one page of a dataset's files. `total` counts the files that match the filters; with no filters it equals the dataset's `file_count`.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/user/dataset/{dataset_id}/files","href":"/api-reference/datasets/list-files-in-a-dataset"}]},{"group":"Inference","pages":[{"title":"Run an inference query (streaming SSE)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/user/inference","href":"/api-reference/inference/run-an-inference-query-streaming-sse"}]}]},{"title":"4Minds API Reference Old","description":"Complete reference for 4Minds REST API endpoints.","hidden":true,"href":"/api-reference"}]}]}]},"basePath":"","title":"Run an inference query (streaming SSE) - 4Minds","buildId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","deploymentId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-DX1Meug0.js","utils-B_OMIQVC.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-ChxhRPMa.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CuKvD8Iv.js","snippetPresets-C5d7p2hp.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-CfHcE8m4.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-C1zZV314.js","shallow-CmQhqCJn.js","getApiPlaygroundDisplay-YRo9s1O7.js","CodeSnippet-RN1MTdfk.js","CodeSnippets-DKLPHxJA.js","Page-BAvA99GL.js","getPastedJson-bz0M41mU.js","icon-CsmhpPrv.js","MethodPill-CNGsVE77.js","DuplicateIcon-DilfU_Z2.js","createIcon-BdsYzQck.js","DynamicMarkdown-CbqEDjbV.js","SectionHeading-O6hXpFCN.js","axios-vUo_bRtp.js","Markdown-nKm-uidQ.js","clsx-ClVdStUn.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CIQkMg3R.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-ImrFS4Fy.js"]}