The class representing a streaming response. With t
Properties
Name
Type
Description
config
RequiredConfig
-
endpointId
string
-
url
string
-
options
StreamOptions<Input>
-
listeners
Map<FalStreamEventType, EventHandler[]>
-
buffer
Output[]
-
currentData
Output | undefined
-
lastEventTimestamp
any
-
streamClosed
any
-
_requestId
string | null
-
donePromise
Promise<Output>
-
abortController
any
-
start
any
-
handleResponse
any
-
handleError
any
-
on
any
-
emit
any
-
done
any
Gets a reference to the Promise that indicates whether the streaming is done or not. Developers should always call this in their apps to ensure the request is over. An alternative to this, is to use on('done') in case your application architecture works best with event listeners.
abort
any
Aborts the streaming request. Note: This method is noop in case the request is already done.
Calls a fal app that supports streaming and provides a streaming-capable
object as a result, that can be used to get partial results through either
AsyncIterator or through an event listener.
function createStreamingClient({ config, storage, }: StreamingClientDependencies): StreamingClient
Parameter
Type
Description
{ config, storage, }
StreamingClientDependencies
-
Returns:StreamingClient
Types
StreamingConnectionMode
type StreamingConnectionMode = "client" | "server"
StreamOptions
type StreamOptions = { /** * The endpoint URL. If not provided, it will be generated from the * `endpointId` and the `queryParams`. */ readonly url?: string; /** * The API input payload. */ readonly input?: Input; /** * The query parameters to be sent with the request. */ readonly queryParams?: Record<string, string>; /** * The maximum time interval in milliseconds between stream chunks. Defaults to 15s. */ readonly timeout?: number; /** * Whether it should auto-upload File-like types to fal's storage * or not. */ readonly autoUpload?: boolean; /** * The HTTP method, defaults to `post`; */ readonly method?: "get" | "post" | "put" | "delete" | string; /** * The content type the client accepts as response. * By default this is set to `text/event-stream`. */ readonly accept?: string; /** * The streaming connection mode. This is used to determine * whether the streaming will be done from the browser itself (client) * or through your own server, either when running on NodeJS or when * using a proxy that supports streaming. * * It defaults to `server`. Set to `client` if your server proxy doesn't * support streaming. */ readonly connectionMode?: StreamingConnectionMode; /** * The signal to abort the request. */ readonly signal?: AbortSignal; /** * A custom token provider function. Only used when `connectionMode` is `"client"`. * When provided, this function will be used to fetch authentication tokens * instead of the default internal token fetching mechanism. */ readonly tokenProvider?: TokenProvider;}
The stream API options. It requires the API input and also
offers configuration options.
Was this page helpful?
⌘I
{"docsConfig":{"theme":"maple","$schema":"https://mintlify.com/docs.json","name":"fal","colors":{"primary":"#5718C0","light":"#C0B1FF","dark":"#5718C0"},"logo":{"light":"https://mintcdn.com/fal-d8505a2e/0cIaYtN4gA36hPQJ/logo/light.svg?fit=max\u0026auto=format\u0026n=0cIaYtN4gA36hPQJ\u0026q=85\u0026s=4b6014d36569092b761c871db9df6a41","dark":"https://mintcdn.com/fal-d8505a2e/0cIaYtN4gA36hPQJ/logo/dark.svg?fit=max\u0026auto=format\u0026n=0cIaYtN4gA36hPQJ\u0026q=85\u0026s=c1760d019183048af07d008cd2377ca4","href":"https://fal.ai/docs"},"favicon":"https://mintcdn.com/fal-d8505a2e/8WsQEbl1OYp5vQ4g/favicon.svg?fit=max\u0026auto=format\u0026n=8WsQEbl1OYp5vQ4g\u0026q=85\u0026s=9b5e82f7c6b96d136d51bce8e2cdd0e2","api":{"params":{"expanded":"all"},"playground":{"display":"interactive","proxy":false},"examples":{"defaults":"required","languages":["curl","python","javascript"],"prefill":true}},"appearance":{"default":"light"},"navbar":{"links":[{"href":"https://fal.ai/enterprise#contact-sales","label":"Contact Sales"}],"primary":{"type":"button","label":"Login","href":"https://fal.ai/login"}},"footer":{"socials":{"discord":"https://discord.gg/fal-ai","x":"https://twitter.com/fal","github":"https://github.com/fal-ai","linkedin":"https://www.linkedin.com/company/features-and-labels"}},"seo":{"metatags":{"og:image":"/logo/light.svg","google-site-verification":"kcN2RYfXHsfUeWlkX6-E32JdCXwUdHA5w5NIXr2xWTY"},"organization":{"id":"https://fal.ai/#organization","legalName":"Features \u0026 Labels Inc.","url":"https://fal.ai/","logo":"https://fal.ai/apple-touch-icon.png","sameAs":["https://discord.gg/fal-ai","https://github.com/fal-ai","https://www.reddit.com/r/fal/","https://twitter.com/fal","https://www.linkedin.com/company/features-and-labels/","https://www.youtube.com/@Fal.AI.Official","https://www.instagram.com/madeonfal","https://www.tiktok.com/@madeonfal"]}},"fonts":{"heading":{"family":"Focal","source":"https://mintlify-assets.b-cdn.net/fonts/Focal-Regular-Web.woff2","format":"woff2"},"body":{"family":"Public Sans"}},"styling":{"eyebrows":"breadcrumbs","latex":true},"integrations":{"posthog":{"apiKey":"phc_BkrygUwvQjwRHnwDjFQtoY77ts2fse3HVTHQUJk5BNO","apiHost":"https://us.i.posthog.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["fal has two developer products. Model APIs run hosted models through an API key. fal Serverless deploys your own Python apps and models on fal GPUs.","To call a hosted model, start with the [Quick Start](https://fal.ai/docs/documentation/quickstart.md) and the [Model APIs overview](https://fal.ai/docs/documentation/model-apis/overview.md).","To deploy your own model with fal Serverless, start with these pages:","- [Introduction to Serverless](https://fal.ai/docs/documentation/serverless/index.md): What fal Serverless is and the three ways to deploy on it.","- [Installation \u0026 Setup](https://fal.ai/docs/documentation/development/getting-started/installation.md): Install the fal CLI with `pip install fal` and authenticate.","- [Quick Start](https://fal.ai/docs/documentation/development/getting-started/quick-start.md): Build a Hello World app, test it with `fal run`, and ship it with `fal deploy`.","- [App Lifecycle](https://fal.ai/docs/documentation/development/app-lifecycle.md): How a `fal.App` goes from code to running runners.","- [Define Your Endpoints](https://fal.ai/docs/documentation/development/endpoints-overview.md): Structure the API endpoints that your app exposes.","- [Deploy to Production](https://fal.ai/docs/documentation/deployment/deploy-to-production.md): Persistent URLs, authentication modes, and automatic scaling.","- [Machine Types](https://fal.ai/docs/documentation/deployment/machine-types.md): Available GPU and CPU machine types and how to choose one.","- [Pricing](https://fal.ai/docs/documentation/serverless/pricing.md): Per-second billing and the runner states that are billed.","- [Scaling Parameter Reference](https://fal.ai/docs/documentation/deployment/scale-your-application.md): Parameters that control runners, concurrency, and scale to zero.","- [Optimizing Cold Starts](https://fal.ai/docs/documentation/serverless/optimizations/optimize-cold-starts.md): Causes of cold starts and ways to make them shorter.","- [Examples](https://fal.ai/docs/examples/index.md): Complete Serverless apps for image, video, audio, 3D, realtime, and multi-GPU workloads.","- [Migrating to fal](https://fal.ai/docs/documentation/development/migrating-to-fal.md): Guides to move an existing Docker server or an app from another platform to fal.","fal Serverless deploys need access that the fal team approves for each account. Request access at https://fal.ai/dashboard/serverless-get-started."]},"navigation":{"global":{"anchors":[{"anchor":"Status","icon":"signal","href":"https://status.fal.ai/"},{"anchor":"Community","icon":"discord","href":"https://discord.gg/fal-ai"},{"anchor":"Blog","icon":"newspaper","href":"https://blog.fal.ai/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"fal-d8505a2e","hasAudioNarration":false,"actualSubdomain":"fal-d8505a2e","customDomains":["fal.ai"],"gitSource":{"type":"github","owner":"fal-ai","repo":"fal-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0f3a771dbb34c498fa3aea","clientVersion":"0.0.4410","searchFilterCounts":[{"language":"default","tag":"Documentation","count":200},{"language":"default","tag":"Model API Reference","count":138},{"language":"default","tag":"Serverless","count":101},{"language":"default","tag":"Platform API","count":86},{"language":"default","tag":"API Endpoints","count":83},{"language":"default","tag":"Image Generation","count":60},{"language":"default","tag":"Video Generation","count":60},{"language":"default","tag":"SDK Reference","count":55},{"language":"default","tag":"fal Agent","count":45},{"language":"default","tag":"Development","count":38}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@fal.ai","showHelpButton":true}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-bash","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":"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":"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":"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":"turbopuffer-dual-write","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":"editor-metadata","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":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:'Focal Medium';src:url('https://mintlify-assets.b-cdn.net/fonts/Focal-Medium-Web.woff2') format('woff2');font-weight:500;font-style:normal;font-display:swap}#content-area::after{content:'';position:fixed;top:80px;right:24px;width:85px;height:225px;background:url('/docs/images/page-decoration.svg') no-repeat center;background-size:contain;pointer-events:none;z-index:10;opacity:0.8}.dark #content-area::after{opacity:0.4}@media (max-width: 1325px){#content-area::after{display:none}}#content-area,#content-area>div,[class*=\"prose\"]{max-width:900px!important}#hero-section{position:relative}#hero-section>*{position:relative;z-index:1}ul#sidebar-group>li>a,ul#sidebar-group>li>button{font-weight:600!important}li[data-group-tag]>ul li>a,li[data-group-tag]>ul li>button{margin-left:2rem!important}#sidebar-content{padding-left:1rem;overflow-x:clip;width:350px!important;min-width:350px!important}@media (min-width: 1024px){#sidebar{width:350px!important}#content-container{margin-left:350px!important}#navbar-transition-maple{left:350px!important}}#sidebar-content{background-color:#f7f7f8!important}.dark #sidebar-content{background-color:#14151A!important}@media (min-width: 1024px){ul.w-\\[calc\\(19rem-1px\\)\\]{width:350px!important;background-color:#f7f7f8!important}.dark ul.w-\\[calc\\(19rem-1px\\)\\]{background-color:#14151A!important}}#sidebar-content::before{content:'';position:absolute;top:0;left:-100vw;width:100vw;height:100%;background-color:#f7f7f8;z-index:-1}.dark #sidebar-content::before{background-color:#14151A}.card-group img[data-component-part=\"card-image\"],.card img[data-component-part=\"card-image\"]{aspect-ratio:16 / 9;height:auto!important;object-fit:cover!important;width:100%!important}.code-group pre,pre[class*=\"language-\"]{max-height:600px;overflow-y:auto}@media (min-width: 1024px){div[id=\"content-container\"]{max-width:100%!important}.peer.is-not-center~.peer-\\[\\.is-not-center\\]\\:max-w-8xl,.peer.is-not-custom~.peer-\\[\\.is-not-custom\\]\\:max-w-8xl,.max-w-8xl{max-width:100%!important}}@media (max-width: 1440px){.peer.is-not-center~.peer-\\[\\.is-not-center\\]\\:max-w-8xl,.peer.is-not-custom~.peer-\\[\\.is-not-custom\\]\\:max-w-8xl,.max-w-8xl{max-width:100%!important}}@media (min-width: 1920px){.peer.is-not-center~.peer-\\[\\.is-not-center\\]\\:max-w-8xl,.peer.is-not-custom~.peer-\\[\\.is-not-custom\\]\\:max-w-8xl,.max-w-8xl{max-width:75%!important}}*:not(li.toc-item):not(li.toc-item *):not(.link):not(.flex-1):not(.flex-1 *){border-radius:4px!important}#navbar input,#navbar [id*=\"search\"],nav input,header input{border-radius:4px!important}#navbar button,#navbar a,#navbar a>*,nav button,nav a,nav a>*,header button,header a,header a>*{border-radius:4px!important}a[href*=\"login\"],a[href*=\"login\"]>*{border-radius:4px!important}#navbar a[href=\"https://fal.ai/\"],#navbar a[href=\"https://fal.ai/\"]>*,nav a[href=\"https://fal.ai/\"],nav a[href=\"https://fal.ai/\"]>*,header a[href=\"https://fal.ai/\"],header a[href=\"https://fal.ai/\"]>*{border-radius:0!important}body{font-feature-settings:'ss01' on!important}[data-tooltip],.tooltip-trigger,span[style*=\"border-bottom\"][style*=\"dotted\"],button[data-state]>span[style*=\"dotted\"],span[class*=\"tooltip\"],[data-radix-tooltip-trigger]{border-bottom-color:#5718C0!important;color:#5718C0!important;text-decoration-color:#5718C0!important}.dark [data-tooltip],.dark .tooltip-trigger,.dark span[style*=\"border-bottom\"][style*=\"dotted\"],.dark button[data-state]>span[style*=\"dotted\"],.dark span[class*=\"tooltip\"],.dark [data-radix-tooltip-trigger]{border-bottom-color:#C0B1FF!important;color:#C0B1FF!important;text-decoration-color:#C0B1FF!important}[data-radix-tooltip-content] a,[role=\"tooltip\"] a,[data-state=\"delayed-open\"]~[data-radix-tooltip-content] a,div[class*=\"tooltip\"] a[href]{color:#C0B1FF!important;text-decoration:underline!important;text-decoration-color:#C0B1FF!important}[data-radix-tooltip-content] a:hover,[role=\"tooltip\"] a:hover,div[class*=\"tooltip\"] a[href]:hover{color:#ddd0ff!important;text-decoration-color:#ddd0ff!important}.mcp-card:hover{border-color:#a78bfa!important;box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)!important}.dark .mcp-card:hover{border-color:#8b5cf6!important}#serverless-access-popup{position:fixed;bottom:20px;right:20px;max-width:400px;background:white;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 10px 25px rgba(0, 0, 0, 0.1);padding:20px;z-index:9999;animation:slideInUp 0.3s ease-out;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif}.dark #serverless-access-popup{background:#1f2937;border-color:#374151;box-shadow:0 10px 25px rgba(0, 0, 0, 0.3)}#serverless-access-popup.hidden{display:none}@keyframes slideInUp{from{transform:translateY(100px);opacity:0}to{transform:translateY(0);opacity:1}}#serverless-access-popup .popup-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}#serverless-access-popup .popup-title{font-size:16px;font-weight:600;color:#111827;margin:0}.dark #serverless-access-popup .popup-title{color:#f9fafb}#serverless-access-popup .popup-close{background:none;border:none;font-size:20px;color:#6b7280;cursor:pointer;padding:0;width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:background-color 0.2s}#serverless-access-popup .popup-close:hover{background-color:#f3f4f6;color:#111827}.dark #serverless-access-popup .popup-close:hover{background-color:#374151;color:#f9fafb}#serverless-access-popup .popup-content{color:#4b5563;font-size:14px;line-height:1.6;margin-bottom:16px}.dark #serverless-access-popup .popup-content{color:#d1d5db}#serverless-access-popup .popup-action{display:inline-block;background-color:#5718C0;color:white;padding:10px 16px;border-radius:6px;text-decoration:none;font-size:14px;font-weight:500;transition:background-color 0.2s;border:none;cursor:pointer}#serverless-access-popup .popup-action:hover{background-color:#4612a0;color:white}@media (max-width: 640px){#serverless-access-popup{left:20px;right:20px;max-width:none}}button[aria-label=\"Try it\"],button[aria-label=\"Send\"],.tryit-button{background-color:rgb(var(--primary-dark) / var(--tw-bg-opacity))}html:has([content=\"Model search - fal\"]) #authorization-authorization [data-component-part=\"field-required-pill\"],html:has([content=\"Model search - fal\"]) [title=\"Authorization\"] [data-component-part=\"field-required-pill\"]{display:none!important}[data-tag=\"Breaking Change\"],.tag[data-tag=\"Breaking Change\"],span:has-text(\"Breaking Change\"){background-color:#fee2e2!important;color:#991b1b!important;border:1px solid #fca5a5!important;font-weight:600!important}.dark [data-tag=\"Breaking Change\"],.dark .tag[data-tag=\"Breaking Change\"],.dark span:has-text(\"Breaking Change\"){background-color:#7f1d1d!important;color:#fecaca!important;border:1px solid #991b1b!important}div:has(>[data-tag=\"Breaking Change\"]){border-left:4px solid #dc2626!important;padding-left:1rem!important}.dark div:has(>[data-tag=\"Breaking Change\"]){border-left-color:#ef4444!important}body:has(#docs-hero-page) #content-area>header,body:has(#docs-hero-page) article>header:first-child,body:has(#docs-hero-page) .prose>h1:first-child,body:has(#docs-hero-page) [class*=\"PageHeader\"],body:has(#docs-hero-page) [class*=\"page-header\"]{display:none!important}.fal-hero-badge{display:inline-flex;align-items:center;gap:0.5rem;padding:0.375rem 0.875rem;background:rgba(87, 24, 192, 0.1);border:1px solid rgba(87, 24, 192, 0.25);border-radius:4px;font-size:0.75rem;color:#5718C0;margin-bottom:1.25rem;font-family:'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;text-transform:uppercase;letter-spacing:0.08em;font-weight:500}.dark .fal-hero-badge{background:rgba(87, 24, 192, 0.15);border-color:rgba(87, 24, 192, 0.35);color:#c0b1ff}.fal-badge-dot{width:6px;height:6px;background:#00ffcc;border-radius:50%;animation:falPulse 2s ease-in-out infinite}@keyframes falPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:0.4;transform:scale(0.8)}}.fal-hero-title{font-family:'Focal Medium', 'Focal', sans-serif!important;font-size:56px!important;font-weight:500!important;line-height:1!important;margin:16px 0 10px 0!important;padding:0!important;letter-spacing:-1.12px!important;color:#242426!important}.dark .fal-hero-title{color:#fafafa!important}.fal-hero-subtitle{font-family:'Focal Medium', 'Focal', sans-serif;font-size:20px;font-weight:500;line-height:1;letter-spacing:-0.4px;color:#242426;margin-bottom:10px}.dark .fal-hero-subtitle{color:#fafafa}.fal-hero-body{font-size:16px;line-height:1.4;margin-bottom:1rem;color:#787881;letter-spacing:-0.32px}.fal-hero-body strong{color:#242426}.dark .fal-hero-body strong{color:#fafafa}.fal-hero-search{display:flex;align-items:center;width:100%;max-width:360px;padding:8px 10px;font-size:13px;color:#9ca3af;background:white;border:1px solid rgba(18, 18, 22, 0.1);cursor:pointer;text-align:left;transition:border-color 0.2s;margin-bottom:1rem}.fal-hero-search:hover{border-color:rgba(18, 18, 22, 0.2)}.dark .fal-hero-search{background:#1f2937;border-color:rgba(255, 255, 255, 0.1);color:#6b7280}.fal-hero-search-icon{width:14px;height:14px;margin-right:8px;flex-shrink:0;color:#787881}.fal-hero-search-text{flex:1}.fal-hero-mcp-link{display:flex;align-items:center;gap:5px;margin-left:auto;padding:3px 8px;font-size:11px;font-weight:600;color:#5718C0!important;background:rgba(133, 83, 255, 0.08);text-decoration:none!important;white-space:nowrap;transition:background 0.2s}.fal-hero-mcp-link:hover{background:rgba(133, 83, 255, 0.15)}.dark .fal-hero-mcp-link{color:#C0B1FF!important;background:rgba(133, 83, 255, 0.15)}.dark .fal-hero-mcp-link:hover{background:rgba(133, 83, 255, 0.25)}.fal-stats-row{display:flex;gap:0.5rem;flex-wrap:wrap;margin-top:1.5rem}.fal-stat-item{position:relative;display:flex;flex-direction:column;gap:8px;min-width:99px}.fal-stat-value{font-family:'Focal Medium', 'Focal', sans-serif;font-size:24px;font-weight:500;line-height:1;letter-spacing:-0.4px;color:#242426;cursor:default}.dark .fal-stat-value{color:#fafafa}.fal-stat-label{font-size:14px;font-weight:500;line-height:1.4;letter-spacing:-0.28px;color:#787881}.fal-hero-section{display:flex;gap:2rem;align-items:flex-start;margin-bottom:1.5rem}.fal-hero-text{flex:1;min-width:0}.fal-hero-image{flex:1;min-width:0}.fal-hero-image img{width:100%;height:auto;display:block}.fal-hero-img-dark{display:none!important}.dark .fal-hero-img-light{display:none!important}.dark .fal-hero-img-dark{display:block!important}.dark .fal-hero-img-dark{display:block!important}.fal-feature-card{transition:all 0.3s ease!important;position:relative;overflow:hidden}.fal-feature-card:hover{transform:translateY(-2px)}@media (max-width: 768px){.fal-hero-section{flex-direction:column;align-items:center}.fal-hero-text{width:100%}.fal-stats-row{gap:1rem}.fal-stat-value{font-size:18px}.fal-hero-image{display:flex;justify-content:center;width:100%}.fal-hero-image img{width:auto;max-width:100%;max-height:260px}}.fal-lifecycle-step{position:relative;margin-bottom:1rem;border-radius:8px;overflow:hidden}.fal-lifecycle-step.serverless{background:linear-gradient(135deg, rgba(51, 134, 254, 0.1) 0%, rgba(51, 134, 254, 0.02) 100%);border-left:3px solid #3386FE}.dark .fal-lifecycle-step.serverless{background:linear-gradient(135deg, rgba(51, 134, 254, 0.15) 0%, rgba(51, 134, 254, 0.05) 100%)}.fal-lifecycle-step.modelapis{background:linear-gradient(135deg, rgba(133, 83, 255, 0.1) 0%, rgba(133, 83, 255, 0.02) 100%);border-left:3px solid #8553FF}.dark .fal-lifecycle-step.modelapis{background:linear-gradient(135deg, rgba(133, 83, 255, 0.2) 0%, rgba(133, 83, 255, 0.05) 100%)}.fal-step-header{display:flex;align-items:center;gap:0.75rem;padding:1rem 1.25rem 0.5rem}.fal-step-number{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;font-size:0.875rem;font-weight:600;flex-shrink:0}.fal-lifecycle-step.serverless .fal-step-number{background:rgba(51, 134, 254, 0.15);color:#1841B5}.dark .fal-lifecycle-step.serverless .fal-step-number{background:rgba(51, 134, 254, 0.25);color:#8EC8FF}.fal-lifecycle-step.modelapis .fal-step-number{background:rgba(133, 83, 255, 0.15);color:#5718C0}.dark .fal-lifecycle-step.modelapis .fal-step-number{background:rgba(133, 83, 255, 0.25);color:#C0B1FF}.fal-step-title{font-size:1.125rem;font-weight:600;flex-grow:1}.fal-step-logo{height:18px;opacity:0.9}.fal-lifecycle-step .fal-step-logo{filter:none}.fal-step-content{padding:0 1.25rem 1rem}.fal-step-content p:first-child{margin-top:0}.fal-step-content ul{margin-bottom:0}@media (max-width: 640px){.fal-step-header{flex-wrap:wrap}.fal-step-logo{order:-1;width:100%;margin-bottom:0.5rem;height:16px}}"}]}
{"page":{"pagePath":"api-reference/client-libraries/javascript/streaming","slug":"/api-reference/client-libraries/javascript/streaming","pageMetadata":{"title":"streaming","sidebarTitle":"streaming","description":"API reference for @fal-ai/client streaming","href":"/api-reference/client-libraries/javascript/streaming"},"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: \"API reference for @fal-ai/client streaming\"\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,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,hr:`hr`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Heading,Table}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`classes-\u0026-interfaces`,children:`Classes \u0026 Interfaces`}),`\n`,_jsx(Heading,{level:`3`,id:`falstream`,children:`FalStream`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` FalStream`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The class representing a streaming response. With t`}),`\n`,_jsx(Accordion,{title:`Properties`,defaultOpen:true,id:`properties`,children:_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Name`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Type`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`config`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`RequiredConfig`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`endpointId`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`url`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`options`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`StreamOptions\u003cInput>`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`listeners`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Map\u003cFalStreamEventType, EventHandler[]>`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`buffer`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Output[]`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`currentData`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Output | undefined`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`lastEventTimestamp`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`streamClosed`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`_requestId`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`string | null`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`donePromise`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Promise\u003cOutput>`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`abortController`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`start`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`handleResponse`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`handleError`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`on`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`emit`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`done`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Gets a reference to the `,_jsx(_components.code,{children:`Promise`}),` that indicates whether the streaming is done or not. Developers should always call this in their apps to ensure the request is over. An alternative to this, is to use `,_jsx(_components.code,{children:`on('done')`}),` in case your application architecture works best with event listeners.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`abort`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`any`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Aborts the streaming request. `,_jsx(_components.strong,{children:`Note:`}),` This method is noop in case the request is already done.`]})]})]})]})}),`\n`,_jsxs(Accordion,{title:`Methods`,defaultOpen:true,id:`methods`,children:[_jsx(Heading,{level:`4`,id:`%5Bsymbol-asynciterator%5D`,children:_jsx(_components.code,{children:`[Symbol.asyncIterator]`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Symbol`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`asyncIterator`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](): `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`any`})]}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`any`})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`streamingclient`,children:`StreamingClient`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamingClient`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The streaming client interface.`}),`\n`,_jsxs(Accordion,{title:`Methods`,defaultOpen:true,id:`methods-1`,children:[_jsx(Heading,{level:`4`,id:`stream`,children:`stream`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endpointId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`StreamOptions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`InputType`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`): `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`Promise`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`FalStream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`InputType`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OutputType`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>>>`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Calls a fal app that supports streaming and provides a streaming-capable\nobject as a result, that can be used to get partial results through either\n`,_jsx(_components.code,{children:`AsyncIterator`}),` or through an event listener.`]}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Parameter`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Type`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`endpointId`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`Id`})}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`the endpoint id, e.g. `,_jsx(_components.code,{children:`fal-ai/llavav15-13b`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`options`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`StreamOptions\u003cInputType\u003cId>>`})}),_jsx(_components.td,{style:{textAlign:`left`},children:`the request options, including the input payload.`})]})]})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`Promise\u003cFalStream\u003cInputType\u003cId>, OutputType\u003cId>>>`})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`functions`,children:`Functions`}),`\n`,_jsx(Heading,{level:`3`,id:`createstreamingclient`,children:`createStreamingClient`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createStreamingClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`storage`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, }`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamingClientDependencies`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamingClient`})]}),`\n`]})})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Parameter`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Type`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`{ config, storage, }`})}),_jsx(_components.td,{style:{textAlign:`left`},children:_jsx(_components.code,{children:`StreamingClientDependencies`})}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`-`})]})})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`StreamingClient`})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`types`,children:`Types`}),`\n`,_jsx(Heading,{level:`3`,id:`streamingconnectionmode`,children:`StreamingConnectionMode`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamingConnectionMode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"server\"`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`streamoptions`,children:`StreamOptions`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`62`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`62`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamOptions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The endpoint URL. If not provided, it will be generated from the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" * `endpointId` and the `queryParams`.\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The API input payload.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` input`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Input`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The query parameters to be sent with the request.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` queryParams`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Record`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The maximum time interval in milliseconds between stream chunks. Defaults to 15s.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * Whether it should auto-upload File-like types to fal's storage`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * or not.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` autoUpload`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" * The HTTP method, defaults to `post`;\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` method`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"get\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"post\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"put\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"delete\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The content type the client accepts as response.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" * By default this is set to `text/event-stream`.\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` accept`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The streaming connection mode. This is used to determine`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * whether the streaming will be done from the browser itself (client)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * or through your own server, either when running on NodeJS or when`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * using a proxy that supports streaming.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` *`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" * It defaults to `server`. Set to `client` if your server proxy doesn't\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * support streaming.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` connectionMode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` StreamingConnectionMode`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * The signal to abort the request.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` signal`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AbortSignal`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:' * A custom token provider function. Only used when `connectionMode` is `\"client\"`.'})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * When provided, this function will be used to fetch authentication tokens`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` * instead of the default internal token fetching mechanism.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` readonly`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` tokenProvider`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` TokenProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The stream API options. It requires the API input and also\noffers configuration options.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"streaming","sidebarTitle":"streaming","description":"API reference for @fal-ai/client streaming","href":"/api-reference/client-libraries/javascript/streaming"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Classes \u0026 Interfaces","slug":"classes-\u0026-interfaces","depth":2,"children":[{"title":"FalStream","slug":"falstream","depth":3,"children":[]},{"title":"StreamingClient","slug":"streamingclient","depth":3,"children":[]}]},{"title":"Functions","slug":"functions","depth":2,"children":[{"title":"createStreamingClient","slug":"createstreamingclient","depth":3,"children":[]}]},{"title":"Types","slug":"types","depth":2,"children":[{"title":"StreamingConnectionMode","slug":"streamingconnectionmode","depth":3,"children":[]},{"title":"StreamOptions","slug":"streamoptions","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/fal-d8505a2e/fbe6cc384b7bbd12/serverless-popup.js","/docs/_mintlify/custom/fal-d8505a2e/9fa06cdd91073ccf/content/playground-hardening.js","/docs/_mintlify/custom/fal-d8505a2e/c80ff4b00a7410c4/content/api-key-formatter.js"],"subdomain":"fal-d8505a2e","siteName":"fal","title":"streaming - fal","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-17T19:22:25.769Z","originalFileLocation":"api-reference/client-libraries/javascript/streaming.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=\"light\"}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=\"API reference for @fal-ai/client streaming\">\u003cmeta data-mint-head name=\"application-name\" content=\"fal\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_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=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"streaming - fal\">\u003cmeta data-mint-head property=\"og:description\" content=\"API reference for @fal-ai/client streaming\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"fal\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://fal-d8505a2e.mintlify.site/docs/logo/light.svg\">\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=\"streaming - fal\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"API reference for @fal-ai/client streaming\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://fal-d8505a2e.mintlify.site/docs/logo/light.svg\">\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=\"/docs/mintlify-assets/_mintlify/favicons/fal-d8505a2e/cUEBujT4zfUs0Rxq/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"fal\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5718C0\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"kcN2RYfXHsfUeWlkX6-E32JdCXwUdHA5w5NIXr2xWTY\">\u003clink data-mint-head rel=\"canonical\" href=\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api-reference/client-libraries/javascript/streaming.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://fal.ai/#organization\",\"name\":\"fal\",\"legalName\":\"Features \u0026 Labels Inc.\",\"url\":\"https://fal.ai/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://fal.ai/apple-touch-icon.png\"},\"sameAs\":[\"https://discord.gg/fal-ai\",\"https://github.com/fal-ai\",\"https://www.reddit.com/r/fal/\",\"https://twitter.com/fal\",\"https://www.linkedin.com/company/features-and-labels/\",\"https://www.youtube.com/@Fal.AI.Official\",\"https://www.instagram.com/madeonfal\",\"https://www.tiktok.com/@madeonfal\"]},{\"@type\":\"WebSite\",\"@id\":\"https://fal.ai/docs#website\",\"name\":\"fal\",\"url\":\"https://fal.ai/docs\",\"publisher\":{\"@id\":\"https://fal.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming#webpage\",\"url\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming\",\"name\":\"streaming\",\"description\":\"API reference for @fal-ai/client streaming\",\"dateModified\":\"2026-11-17T19:22:25.769Z\",\"isPartOf\":{\"@id\":\"https://fal.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Client Libraries\",\"item\":\"https://fal.ai/docs/api-reference/client-libraries\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https://fal.ai/docs/api-reference/client-libraries/javascript\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"streaming\",\"item\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming#article\",\"headline\":\"streaming\",\"name\":\"streaming\",\"description\":\"API reference for @fal-ai/client streaming\",\"url\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming\",\"mainEntityOfPage\":{\"@id\":\"https://fal.ai/docs/api-reference/client-libraries/javascript/streaming#webpage\"},\"image\":\"https://fal.ai/logo/light.svg\",\"dateModified\":\"2026-11-17T19:22:25.769Z\",\"publisher\":{\"@id\":\"https://fal.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://fal.ai/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/api-reference/client-libraries/javascript/streaming.md","siteName":"fal","nav":{"global":{"anchors":[{"anchor":"Status","icon":"signal","href":"https://status.fal.ai/"},{"anchor":"Community","icon":"discord","href":"https://discord.gg/fal-ai"},{"anchor":"Blog","icon":"newspaper","href":"https://blog.fal.ai/"}]},"tabs":[{"tab":"Documentation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/docs.svg","pages":[{"title":"Documentation","href":"/documentation"}]},{"tab":"Examples","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/grid-9.svg","pages":[{"title":"Examples","href":"/examples"}]},{"tab":"Model API Reference","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/ar-cube-1.svg","pages":[{"title":"Model API Reference","href":"/model-api-reference"}]},{"tab":"SDK Reference","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/code-brackets.svg","pages":[{"title":"Reference","href":"/api-reference"},{"group":"Client Libraries","pages":[{"title":"Client Libraries","sidebarTitle":"Client Libraries","href":"/api-reference/client-libraries/index"},{"group":"Python","pages":[{"title":"Python Client","sidebarTitle":"Overview","href":"/api-reference/client-libraries/python/index"},{"title":"fal_client","sidebarTitle":"fal_client","href":"/api-reference/client-libraries/python/fal_client"}]},{"group":"JavaScript","pages":[{"title":"JavaScript Client","sidebarTitle":"Overview","href":"/api-reference/client-libraries/javascript/index"},{"title":"auth","sidebarTitle":"auth","href":"/api-reference/client-libraries/javascript/auth"},{"title":"client","sidebarTitle":"client","href":"/api-reference/client-libraries/javascript/client"},{"title":"config","sidebarTitle":"config","href":"/api-reference/client-libraries/javascript/config"},{"title":"middleware","sidebarTitle":"middleware","href":"/api-reference/client-libraries/javascript/middleware"},{"title":"queue","sidebarTitle":"queue","href":"/api-reference/client-libraries/javascript/queue"},{"title":"realtime","sidebarTitle":"realtime","href":"/api-reference/client-libraries/javascript/realtime"},{"title":"response","sidebarTitle":"response","href":"/api-reference/client-libraries/javascript/response"},{"title":"retry","sidebarTitle":"retry","href":"/api-reference/client-libraries/javascript/retry"},{"title":"storage","sidebarTitle":"storage","description":"API reference for @fal-ai/client storage","href":"/api-reference/client-libraries/javascript/storage"},{"title":"streaming","sidebarTitle":"streaming","href":"/api-reference/client-libraries/javascript/streaming"},{"title":"types.client","sidebarTitle":"types.client","description":"API reference for @fal-ai/client types.client","href":"/api-reference/client-libraries/javascript/types.client"},{"title":"types.common","sidebarTitle":"types.common","href":"/api-reference/client-libraries/javascript/types.common"},{"title":"utils","sidebarTitle":"utils","href":"/api-reference/client-libraries/javascript/utils"}]},{"title":"Swift Client","sidebarTitle":"Swift","href":"/api-reference/client-libraries/swift/index"},{"title":"Kotlin / Java Client","sidebarTitle":"Kotlin / Java","href":"/api-reference/client-libraries/kotlin/index"},{"title":"Dart Client","sidebarTitle":"Dart","href":"/api-reference/client-libraries/dart/index"}]},{"group":"CLI Reference","pages":[{"title":"CLI Reference","href":"/api-reference/cli/index"},{"title":"Installation","href":"/api-reference/cli/installation"},{"title":"fal auth","href":"/api-reference/cli/auth"},{"group":"fal apps","pages":[{"title":"fal apps list","href":"/api-reference/cli/apps/list"},{"title":"fal apps list-rev","href":"/api-reference/cli/apps/list-rev"},{"title":"fal apps set-rev","href":"/api-reference/cli/apps/set-rev"},{"title":"fal apps rollout","href":"/api-reference/cli/apps/rollout"},{"title":"fal apps scale","href":"/api-reference/cli/apps/scale"},{"title":"fal apps runners","href":"/api-reference/cli/apps/runners"},{"title":"fal apps gpus","href":"/api-reference/cli/apps/gpus"},{"title":"fal apps delete","href":"/api-reference/cli/apps/delete"},{"title":"fal apps delete-rev","href":"/api-reference/cli/apps/delete-rev"}]},{"title":"fal deploy","href":"/api-reference/cli/deploy"},{"title":"fal environments","href":"/api-reference/cli/environments"},{"title":"fal files","href":"/api-reference/cli/files"},{"title":"fal run","href":"/api-reference/cli/run"},{"title":"fal queue","href":"/api-reference/cli/queue"},{"title":"fal keys","href":"/api-reference/cli/keys"},{"title":"fal profile","href":"/api-reference/cli/profile"},{"title":"fal secrets","href":"/api-reference/cli/secrets"},{"title":"fal doctor","href":"/api-reference/cli/doctor"},{"title":"fal create","href":"/api-reference/cli/create"},{"title":"fal runners","href":"/api-reference/cli/runners"},{"title":"fal account","href":"/api-reference/cli/teams"},{"title":"fal api","href":"/api-reference/cli/api"}]},{"group":"Python SDK","pages":[{"title":"Python SDK","sidebarTitle":"Overview","href":"/api-reference/python-sdk/fal-app-reference"},{"title":"pyproject.toml Reference","sidebarTitle":"pyproject.toml","href":"/api-reference/python-sdk/pyproject-toml"},{"title":"SyncServerlessClient","href":"/api-reference/python-sdk/client"},{"title":"fal.api","sidebarTitle":"fal.api","href":"/api-reference/python-sdk/api-reference"},{"title":"fal","sidebarTitle":"fal","href":"/api-reference/python-sdk/fal"},{"title":"fal.distributed","sidebarTitle":"fal.distributed","href":"/api-reference/python-sdk/fal-distributed"},{"title":"fal.exceptions","sidebarTitle":"fal.exceptions","href":"/api-reference/python-sdk/fal-exceptions"},{"title":"fal.toolkit","sidebarTitle":"fal.toolkit","href":"/api-reference/python-sdk/fal-toolkit"},{"title":"fal.toolkit.image.nsfw_filter","sidebarTitle":"fal.toolkit.image.nsfw_filter","href":"/api-reference/python-sdk/fal-toolkit-image-nsfw-filter"}]}]},{"tab":"Inference API","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/file-json.svg","pages":[{"title":"Inference API","href":"/api-reference/inference-api"}]},{"tab":"Platform API","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/layers-three.svg","pages":[{"title":"Platform API","href":"/api-reference/platform-apis"}]},{"tab":"Changelog","icon":"https://mintlify.s3.us-west-1.amazonaws.com/fal-d8505a2e/images/icons/clock.svg","href":"https://fal.ai/changelog"}]},"basePath":"","title":"streaming - fal","deploymentId":"dpl_4jsQX6wxBTKTWBK49utMnZg6AX9Q","buildId":"dpl_4jsQX6wxBTKTWBK49utMnZg6AX9Q","dynamics":[],"chunks":[]}