Add "stream": true. Response is Server-Sent Events (text/event-stream). Each chunk is data: {...}\n\n; the stream ends with data: [DONE]\n\n.The final chunk before [DONE] carries usage info and Infery-specific credits_used:
The gateway resolves file_id to bytes on the server, injects them into the provider call, and returns a clear 400 if the id doesn’t exist or is out of your workspace.
All file_id references in one request must total 64 MB or less, decoded.This is a limit on the sum, and it is separate from your plan’s per-file
max_file_size_bytes. Both apply. Every file can be individually within your
plan’s per-file cap and the request can still be refused for their total —
that is the intended behaviour, because the server resolves all of them at once.
{ "error": { "message": "Attachments total at least 78643200 bytes, above the 67108864-byte limit for one request. This is a limit on the SUM of all attached files, not on any single one — reference fewer files, or smaller ones.", "type": "invalid_request_error", "code": "attachments_too_large", "param": "messages[].content[].file_id" }}
attachments_too_large always means the total, never one file. A single file
that is too big for your plan is refused at upload time by /v1/files instead.
Split the work across turns, or reference smaller files.
The cap is on decoded bytes, so it is the sum of the file sizes you see in
/v1/files — not the size of the JSON request, which only carries the ids.
Inline data blocks are not counted against it; they are bounded by the
request body limit and by each model’s own per-file limits.
Works exactly like OpenAI’s spec — tools, tool_choice, function schema and tool role messages. Every chat-capable model on Infery that supports tools honours the same format.
Models with supportsVision: true accept images directly. For PDFs, models with supportsPdf: true read them natively. Others get an automatic PDF-to-image conversion on the gateway (plus text extraction) — you pay a small extra fee per page (see billing), no code changes required.
Cost isn’t a header here: chat completions return credits_used in the JSON response
body, or in the final SSE chunk when streaming. x-credits-used exists only on
binary-body endpoints that have no JSON body to carry it, like text-to-speech.
Tool definitions available to the model. The gateway translates ONLY entries shaped {type:"function", function:{name, description?, parameters?}} into each provider's native tool-calling form; any other entry is forwarded upstream byte-identical — provider-native tools (web search, grounding, …) already arrive in their own shape.
Controls whether/which tool the model must call: "none", "auto", "required", or {type:"function", function:{name}} to force one specific function tool.
Optional cache-routing key for providers that cache prompt prefixes per-server (xAI, OpenAI). Send the same value across turns of one conversation to improve cache hit rate. Mirrors OpenAI’s own parameter of the same name.
Ground the completion in web search, without having to write a provider-native tool entry by hand. Sending this object is the opt-in; there is no boolean form and its absence means no search.
It is a SHORTHAND over tools, and the two reach the same place: the gateway resolves a backend from web_search.provider (or the model family) and, for the natively-grounded providers, injects the matching entry into tools before forwarding — then removes web_search itself, so the upstream provider never sees this key. Sending the provider-native tool entry in tools yourself is the equivalent long form and needs no web_search; send one or the other rather than both.
BILLED. The brave backend runs as a separate search charge reported as web_search_credits on the response, on top of the completion's own tokens; the natively-grounded backends bill through the upstream provider's own search pricing.
Show child attributes
Response
stream=false (default) returns application/json — a single chat-completion object, shown below. stream=true returns text/event-stream: a sequence of data: <json>\n\n lines terminated by a literal data: [DONE]. OpenAPI 3.0 has no way to describe a framed event stream, so the text/event-stream schema below describes the JSON payload of a SINGLE data: line (a chat.completion.chunk) — never the whole body. The final chunk before [DONE] carries usage and credits_used alongside an EMPTY choices array; every other chunk carries a non-empty choices with an incremental delta.
Credits charged for the grounded web search this request performed, separate from credits_used, which covers the model call. Present only when a web-search provider actually ran.
What the grounded search actually did. Present only when a web-search provider ran. The same object rides the final SSE chunk when streaming.
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Infery.ai","colors":{"primary":"#2E5BE8","light":"#7B99F2","dark":"#1F41B0"},"logo":{"light":"https://mintcdn.com/inferyai/0Jgb47bSQtZI-re9/brand/logo-light.svg?fit=max\u0026auto=format\u0026n=0Jgb47bSQtZI-re9\u0026q=85\u0026s=d3ebed9120aa8e785f372aa43a7cccf3","dark":"https://mintcdn.com/inferyai/0Jgb47bSQtZI-re9/brand/logo-dark.svg?fit=max\u0026auto=format\u0026n=0Jgb47bSQtZI-re9\u0026q=85\u0026s=da2c52e6d74e21413d1e79df66776bb3"},"favicon":"https://mintcdn.com/inferyai/rVSpR6coVFjanvjI/brand/icon.svg?fit=max\u0026auto=format\u0026n=rVSpR6coVFjanvjI\u0026q=85\u0026s=9fa7355d4fc03bbe56cb42824f82e371","background":{"color":{"light":"#FFFFFF","dark":"#08090B"}},"navbar":{"links":[{"href":"https://app.infery.ai","label":"Studio"},{"href":"https://infery.ai/pricing","label":"Pricing"}],"primary":{"type":"button","label":"Sign in","href":"https://app.infery.ai/login"}},"footer":{"socials":{"website":"https://infery.ai","x":"https://x.com/infery_ai","github":"https://github.com/infery-ai"}},"seo":{"metatags":{"og:site_name":"Infery.ai Docs","og:type":"website","og:image":"https://docs.infery.ai/brand/og.jpg","twitter:card":"summary_large_image","twitter:site":"@infery_ai","robots":"index, follow"},"indexing":"all"},"fonts":{"heading":{"family":"Bricolage Grotesque","weight":700},"body":{"family":"IBM Plex Sans","weight":400}},"integrations":{"gtm":{"tagId":"GTM-P3237J9B"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"inferyai","hasAudioNarration":false,"actualSubdomain":"inferyai","customDomains":["docs.infery.ai"],"gitSource":{"type":"github","owner":"infery-ai","repo":"infery-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ac0d01453c5cd08031ddef8","collectionId":"e9cbfa7c-70b0-4c88-a370-6174686c606c","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ac0d01453c5cd08031ddef8"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ac0d01453c5cd08031ddef8","clientVersion":"0.0.3965","searchFilterCounts":[{"language":"default","tag":"Guides","count":85},{"language":"default","tag":"API Reference","count":38},{"language":"default","tag":"Workflows","count":20},{"language":"default","tag":"Models","count":17},{"language":"default","tag":"Studio","count":10},{"language":"default","tag":"Tools","count":8},{"language":"default","tag":"SDKs","count":6},{"language":"default","tag":"Files","count":5},{"language":"default","tag":"Workspaces","count":5},{"language":"default","tag":"Overview","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","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":"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":"pause-universal-search-reconcile","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":"per-site-search-delta","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":"editor-private-page-search","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":"editor-nav-generations","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":"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":"byok-sep-25","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":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","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}],"isAtlas":false,"googleFontsInlined":true},"customCss":[],"page":{"pagePath":"api-reference/chat-completions","slug":"/api-reference/chat-completions","pageMetadata":{"title":"Chat completions","description":"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.","openapi":"openapi.json POST /v1/chat/completions","href":"/api-reference/chat-completions"},"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: \"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\"\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={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Drop-in OpenAI-compatible chat endpoint. Supports streaming, tool calls, JSON mode, vision, PDF, audio input and `,_jsxs(_components.strong,{children:[`Files API `,_jsx(_components.code,{children:`file_id`}),` references`]}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`minimal-example`,children:`Minimal example`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`curl`,numberOfLines:`9`,language:`shellscript`,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:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://api.infery.ai/v1/chat/completions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$INFERY_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"gpt-4o\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"messages\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {\"role\": \"user\", \"content\": \"Summarise Node.js streams in 2 sentences\"}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`python`,numberOfLines:`6`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.infery.ai/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat.completions.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hi\"`}),_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`]})})}),_jsx(CodeBlock,{filename:`node`,numberOfLines:`6`,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:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'openai'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`INFERY_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://api.infery.ai/v1'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` resp`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'gpt-4o'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hi'`}),_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(Heading,{level:`2`,id:`streaming`,children:`Streaming`}),`\n`,_jsxs(_components.p,{children:[`Add `,_jsx(_components.code,{children:`\"stream\": true`}),`. Response is Server-Sent Events (`,_jsx(_components.code,{children:`text/event-stream`}),`). Each chunk is `,_jsx(_components.code,{children:`data: {...}\\\\n\\\\n`}),`; the stream ends with `,_jsx(_components.code,{children:`data: [DONE]\\\\n\\\\n`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsxs(_components.strong,{children:[`final chunk before `,_jsx(_components.code,{children:`[DONE]`})]}),` carries usage info and Infery-specific `,_jsx(_components.code,{children:`credits_used`}),`:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`5`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"choices\":[{\"delta\":{\"content\":\"...\"}}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"choices\":[],\"usage\":{\"prompt_tokens\":42,\"completion_tokens\":128}}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"choices\":[],\"usage\":{...},\"credits_used\":2}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: [DONE]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`OpenAI SDKs ignore chunks with empty `,_jsx(_components.code,{children:`choices`}),`, so `,_jsx(_components.code,{children:`credits_used`}),` is a non-breaking extension.`]}),`\n`,_jsx(Heading,{level:`2`,id:`multimodal-content`,children:`Multimodal content`}),`\n`,_jsxs(_components.p,{children:[`Pass arrays in `,_jsx(_components.code,{children:`content`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What's in this image?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"image_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"image_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://example.com/photo.jpg\"`}),_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`,_jsx(_components.span,{className:`line`,children:_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:`Supported block types:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`text`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`image_url`}),` — HTTP URL or base64 `,_jsx(_components.code,{children:`data:`}),` URI`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`input_audio`}),` — inline base64 audio with `,_jsx(_components.code,{children:`format`}),` (wav/mp3/pcm16/webm)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`file`}),` — inline `,_jsx(_components.code,{children:`data`}),` + `,_jsx(_components.code,{children:`mime_type`}),` `,_jsx(_components.strong,{children:`or`}),` `,_jsx(_components.code,{children:`file_id`}),` reference (`,_jsx(_components.a,{href:`/api-reference/files`,children:`Files API`}),`)`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`using-a-files-api-reference`,children:`Using a Files API reference`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Review this PDF\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"file_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file_abc123...\"`}),_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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The gateway resolves `,_jsx(_components.code,{children:`file_id`}),` to bytes on the server, injects them into the provider call, and returns a clear 400 if the id doesn’t exist or is out of your workspace.`]}),`\n`,_jsx(Heading,{level:`3`,id:`total-attachment-size-per-request`,children:`Total attachment size per request`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`All `,_jsx(_components.code,{children:`file_id`}),` references in one request must total 64 MB or less, decoded.`]})}),`\n`,_jsxs(_components.p,{children:[`This is a limit on the `,_jsx(_components.strong,{children:`sum`}),`, and it is separate from your plan’s per-file\n`,_jsx(_components.code,{children:`max_file_size_bytes`}),`. Both apply. Every file can be individually within your\nplan’s per-file cap and the request can still be refused for their total —\nthat is the intended behaviour, because the server resolves all of them at once.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Attachments total at least 78643200 bytes, above the 67108864-byte limit for one request. This is a limit on the SUM of all attached files, not on any single one — reference fewer files, or smaller ones.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_request_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"attachments_too_large\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"param\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"messages[].content[].file_id\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_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(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`attachments_too_large`}),` always means the total, never one file. A single file\nthat is too big for your plan is refused at upload time by `,_jsx(_components.code,{children:`/v1/files`}),` instead.\nSplit the work across turns, or reference smaller files.`]})}),`\n`,_jsxs(_components.p,{children:[`The cap is on decoded bytes, so it is the sum of the file sizes you see in\n`,_jsx(_components.code,{children:`/v1/files`}),` — not the size of the JSON request, which only carries the ids.\nInline `,_jsx(_components.code,{children:`data`}),` blocks are not counted against it; they are bounded by the\nrequest body limit and by each model’s own per-file limits.`]}),`\n`,_jsx(Heading,{level:`2`,id:`tool-calls`,children:`Tool calls`}),`\n`,_jsxs(_components.p,{children:[`Works exactly like OpenAI’s spec — `,_jsx(_components.code,{children:`tools`}),`, `,_jsx(_components.code,{children:`tool_choice`}),`, `,_jsx(_components.code,{children:`function`}),` schema and `,_jsx(_components.code,{children:`tool`}),` role messages. Every chat-capable model on Infery that supports tools honours the same format.`]}),`\n`,_jsx(Heading,{level:`2`,id:`json-mode`,children:`JSON mode`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"response_format\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"json_object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}}`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or with a schema (Structured Outputs):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"response_format\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"json_schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"json_schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"strict\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`vision-and-pdfs`,children:`Vision and PDFs`}),`\n`,_jsxs(_components.p,{children:[`Models with `,_jsx(_components.code,{children:`supportsVision: true`}),` accept images directly. For PDFs, models with `,_jsx(_components.code,{children:`supportsPdf: true`}),` read them natively. Others get an `,_jsx(_components.strong,{children:`automatic PDF-to-image conversion`}),` on the gateway (plus text extraction) — you pay a small extra fee per page (see billing), no code changes required.`]}),`\n`,_jsx(Heading,{level:`2`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(_components.p,{children:[`Full OpenAI parameter set: `,_jsx(_components.code,{children:`temperature`}),`, `,_jsx(_components.code,{children:`top_p`}),`, `,_jsx(_components.code,{children:`presence_penalty`}),`, `,_jsx(_components.code,{children:`frequency_penalty`}),`, `,_jsx(_components.code,{children:`max_tokens`}),`, `,_jsx(_components.code,{children:`stop`}),`, `,_jsx(_components.code,{children:`seed`}),`, `,_jsx(_components.code,{children:`stream`}),`, `,_jsx(_components.code,{children:`tools`}),`, `,_jsx(_components.code,{children:`tool_choice`}),`, `,_jsx(_components.code,{children:`response_format`}),`. Plus model-specific:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`top_k`}),` — Gemini and some OSS models`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`response-headers`,children:`Response headers`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`x-request-id`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`x-model-used`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`x-fallback-from`})}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Cost isn’t a header here: chat completions return `,_jsx(_components.code,{children:`credits_used`}),` in the JSON response\nbody, or in the final SSE chunk when streaming. `,_jsx(_components.code,{children:`x-credits-used`}),` exists only on\nbinary-body endpoints that have no JSON body to carry it, like text-to-speech.`]})]})}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":"Chat completions","description":"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.","openapi":"openapi.json POST /v1/chat/completions","href":"/api-reference/chat-completions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Minimal example","slug":"minimal-example","depth":2,"children":[]},{"title":"Streaming","slug":"streaming","depth":2,"children":[]},{"title":"Multimodal content","slug":"multimodal-content","depth":2,"children":[{"title":"Using a Files API reference","slug":"using-a-files-api-reference","depth":3,"children":[]},{"title":"Total attachment size per request","slug":"total-attachment-size-per-request","depth":3,"children":[]}]},{"title":"Tool calls","slug":"tool-calls","depth":2,"children":[]},{"title":"JSON mode","slug":"json-mode","depth":2,"children":[]},{"title":"Vision and PDFs","slug":"vision-and-pdfs","depth":2,"children":[]},{"title":"Parameters","slug":"parameters","depth":2,"children":[]},{"title":"Response headers","slug":"response-headers","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"ChatController_completions","parameters":["2875cc63-7dec-47c4-bc24-a5b24b8ecce9"],"requestBody":"1d42dbd3-8944-49dd-bff4-e2befff17622","responses":{"200":"2ef01296-d13f-4f5f-8812-9921afb95584","400":"150bb477-983c-4995-846d-9e88c9eb1325","401":"bbeecfac-d9f5-46e4-b5c5-84478df87c18","404":"ad01f309-d79f-4f9b-9081-a20f8eba2031"},"security":["2462593b-0ae9-45e0-8f61-1bf916b1035d"],"summary":"Create chat completion","tags":["Chat Completions"],"method":"post","type":"path","servers":["70c58c78-558b-477f-817f-fa094a9f1354","250da9ba-2678-444c-bc3b-e169d87db6d0"],"path":"/v1/chat/completions","baseUrlOptions":["https://api.infery.ai","http://localhost:3001"],"title":"Create chat completion","description":"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"2875cc63-7dec-47c4-bc24-a5b24b8ecce9":{"name":"x-request-id","in":"header","description":"Optional request ID for tracking","required":false,"schema":{"type":"string","isRequired":false,"description":"Optional request ID for tracking","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Model ID","example":"gpt-4o","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"],"example":"user","isRequired":true,"uniqueKey":"messages.items.[INDEX].role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"string","description":"Message content: a plain string, or an array of content parts for multimodal input (text, `image_url`, `input_audio`, `file`).","example":"Hello!","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","required":["type","text"],"properties":{"type":{"type":"string","enum":["text"],"example":"text","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","example":"What is in this image?","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"object"},{"type":"object","required":["type","image_url"],"properties":{"type":{"type":"string","enum":["image_url"],"example":"image_url","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"object","properties":{"url":{"type":"string","description":"Either an `http(s):` URL or a `data:\u003cmime>;base64,\u003cdata>` data URI.","example":"https://example.com/photo.png","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.image_url.url","typeLabel":"string"}},"required":["url"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"object"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"object"},{"type":"object","required":["type","input_audio"],"properties":{"type":{"type":"string","enum":["input_audio"],"example":"input_audio","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"input_audio":{"type":"object","properties":{"data":{"type":"string","description":"Base64-encoded audio data.","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.2.input_audio.data","typeLabel":"string"},"format":{"type":"string","description":"Audio encoding/format, e.g. `wav`, `mp3`.","example":"wav","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.2.input_audio.format","typeLabel":"string"}},"required":["data","format"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.2.input_audio","typeLabel":"object"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.2","typeLabel":"object"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["file"],"example":"file","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"file":{"type":"object","properties":{"data":{"type":"string","description":"Base64-encoded file data. Alternative to `file_id` and `url` — see the class description.","uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file.data","typeLabel":"string"},"mime_type":{"type":"string","description":"MIME type of `data`.","example":"application/pdf","uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file.mime_type","typeLabel":"string"},"file_id":{"type":"string","description":"Id of a file previously uploaded via `POST /v1/files`. Alternative to `data` and `url` — see the class description. May also be given as the shorthand `file_id` directly on the content part.","example":"file_1hR9xTPZqK4mVLc2nJ7fY5wB","uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file.file_id","typeLabel":"string"},"url":{"type":"string","description":"Source URL for the file content. Alternative to `data` and `file_id` — see the class description. Passed through as-is to the Anthropic and Google provider paths, which accept a file by URL natively.","example":"https://example.com/report.pdf","uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file.url","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file","typeLabel":"object"},"file_id":{"type":"string","description":"Shorthand for `file.file_id` — the controller reads whichever is present (`file.file_id ?? file_id` at the top level). A `file_id` refers to a file from `POST /v1/files` and is resolved server-side into inline base64 (`file.data`/`file.mime_type`) before the provider sees it.","example":"file_1hR9xTPZqK4mVLc2nJ7fY5wB","uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3.file_id","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX].oneOf.3","typeLabel":"object"}],"uniqueKey":"messages.items.[INDEX].content.oneOf.1.items.[INDEX]","typeLabel":"object"},"description":"Message content: a plain string, or an array of content parts for multimodal input (text, `image_url`, `input_audio`, `file`).","example":"Hello!","isRequired":true,"uniqueKey":"messages.items.[INDEX].content.oneOf.1","typeLabel":"object[]"}],"isRequired":true,"uniqueKey":"messages.items.[INDEX].content","typeLabel":"string | object[]"},"name":{"type":"string","description":"Participant name.","uniqueKey":"messages.items.[INDEX].name","typeLabel":"string"},"tool_call_id":{"type":"string","description":"Id of the tool call this message answers. Present on a `role: \"tool\"` result message, echoing `id` from the assistant's `tool_calls` entry it responds to.","example":"call_abc123","uniqueKey":"messages.items.[INDEX].tool_call_id","typeLabel":"string"},"tool_calls":{"description":"Tool calls made by the model. Present on an `assistant` message that called tools.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Tool call id. On a `tool` result message, echoed back as `tool_call_id`.","example":"call_abc123","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"example":"function","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"Function name the model wants to call.","example":"get_weather","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"JSON-encoded (stringified) arguments for the function call.","example":"{\"location\":\"Paris\"}","isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"required":["name","arguments"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["id","type","function"],"uniqueKey":"messages.items.[INDEX].tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"messages.items.[INDEX].tool_calls","typeLabel":"object[]"}},"required":["role","content"],"uniqueKey":"messages.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"messages","typeLabel":"object[]"},"temperature":{"type":"number","minimum":0,"maximum":2,"uniqueKey":"temperature","typeLabel":"number"},"max_tokens":{"type":"integer","uniqueKey":"max_tokens","typeLabel":"integer"},"top_p":{"type":"number","minimum":0,"maximum":1,"uniqueKey":"top_p","typeLabel":"number"},"top_k":{"type":"integer","description":"Top-K sampling (Google Gemini)","uniqueKey":"top_k","typeLabel":"integer"},"presence_penalty":{"type":"number","minimum":-2,"maximum":2,"description":"Presence penalty (OpenAI, Google Gemini)","uniqueKey":"presence_penalty","typeLabel":"number"},"frequency_penalty":{"type":"number","minimum":-2,"maximum":2,"description":"Frequency penalty (OpenAI, Google Gemini)","uniqueKey":"frequency_penalty","typeLabel":"number"},"seed":{"type":"integer","description":"Seed for deterministic output (OpenAI, Google Gemini)","uniqueKey":"seed","typeLabel":"integer"},"stream":{"type":"boolean","default":false,"uniqueKey":"stream","typeLabel":"boolean"},"stop":{"oneOf":[{"type":"string","uniqueKey":"stop.oneOf.0","typeLabel":"string"},{"type":"array","items":{"type":"string","uniqueKey":"stop.oneOf.1.items.[INDEX]","typeLabel":"string"},"uniqueKey":"stop.oneOf.1","typeLabel":"string[]"}],"uniqueKey":"stop","typeLabel":"string | string[]"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","required":["type","function"],"properties":{"type":{"type":"string","enum":["function"],"example":"function","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"Function name.","example":"get_weather","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.function.name","typeLabel":"string"},"description":{"type":"string","description":"Description of what the function does, used by the model to decide when to call it.","example":"Get the current weather for a location.","uniqueKey":"tools.items.[INDEX].oneOf.0.function.description","typeLabel":"string"},"parameters":{"type":"object","additionalProperties":true,"description":"JSON Schema describing the function's parameters.","uniqueKey":"tools.items.[INDEX].oneOf.0.function.parameters","typeLabel":"object"}},"required":["name"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.function","typeLabel":"object"}},"uniqueKey":"tools.items.[INDEX].oneOf.0","typeLabel":"object"},{"type":"object","additionalProperties":true,"uniqueKey":"tools.items.[INDEX].oneOf.1","typeLabel":"object"}],"uniqueKey":"tools.items.[INDEX]","typeLabel":"object"},"description":"Tool definitions available to the model. The gateway translates ONLY entries shaped `{type:\"function\", function:{name, description?, parameters?}}` into each provider's native tool-calling form; any other entry is forwarded upstream byte-identical — provider-native tools (web search, grounding, …) already arrive in their own shape.","uniqueKey":"tools","typeLabel":"object[]"},"tool_choice":{"oneOf":[{"type":"string","description":"Controls whether/which tool the model must call: `\"none\"`, `\"auto\"`, `\"required\"`, or `{type:\"function\", function:{name}}` to force one specific function tool.","enum":["none","auto","required"],"uniqueKey":"tool_choice.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"object","description":"Controls whether/which tool the model must call: `\"none\"`, `\"auto\"`, `\"required\"`, or `{type:\"function\", function:{name}}` to force one specific function tool.","required":["type","function"],"properties":{"type":{"type":"string","enum":["function"],"example":"function","isRequired":true,"uniqueKey":"tool_choice.oneOf.1.type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"Name of the function tool to force.","example":"get_weather","isRequired":true,"uniqueKey":"tool_choice.oneOf.1.function.name","typeLabel":"string"}},"required":["name"],"isRequired":true,"uniqueKey":"tool_choice.oneOf.1.function","typeLabel":"object"}},"uniqueKey":"tool_choice.oneOf.1","typeLabel":"object"}],"uniqueKey":"tool_choice","typeLabel":"enum\u003cstring> | object"},"response_format":{"oneOf":[{"type":"object","description":"Output format constraint: `{type:\"text\"}`, `{type:\"json_object\"}`, or `{type:\"json_schema\", json_schema:{...}}`.","required":["type"],"properties":{"type":{"type":"string","enum":["text"],"isRequired":true,"uniqueKey":"response_format.oneOf.0.type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"response_format.oneOf.0","typeLabel":"object"},{"type":"object","description":"Output format constraint: `{type:\"text\"}`, `{type:\"json_object\"}`, or `{type:\"json_schema\", json_schema:{...}}`.","required":["type"],"properties":{"type":{"type":"string","enum":["json_object"],"isRequired":true,"uniqueKey":"response_format.oneOf.1.type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"response_format.oneOf.1","typeLabel":"object"},{"type":"object","description":"Output format constraint: `{type:\"text\"}`, `{type:\"json_object\"}`, or `{type:\"json_schema\", json_schema:{...}}`.","required":["type","json_schema"],"properties":{"type":{"type":"string","enum":["json_schema"],"isRequired":true,"uniqueKey":"response_format.oneOf.2.type","typeLabel":"enum\u003cstring>"},"json_schema":{"type":"object","additionalProperties":true,"isRequired":true,"uniqueKey":"response_format.oneOf.2.json_schema","typeLabel":"object"}},"uniqueKey":"response_format.oneOf.2","typeLabel":"object"}],"uniqueKey":"response_format","typeLabel":"object"},"prompt_cache_key":{"type":"string","description":"Optional cache-routing key for providers that cache prompt prefixes per-server (xAI, OpenAI). Send the same value across turns of one conversation to improve cache hit rate. Mirrors OpenAI’s own parameter of the same name.","uniqueKey":"prompt_cache_key","typeLabel":"string"},"web_search":{"type":"object","description":"Ground the completion in web search, without having to write a provider-native tool entry by hand. Sending this object is the opt-in; there is no boolean form and its absence means no search.\n\nIt is a SHORTHAND over `tools`, and the two reach the same place: the gateway resolves a backend from `web_search.provider` (or the model family) and, for the natively-grounded providers, injects the matching entry into `tools` before forwarding — then removes `web_search` itself, so the upstream provider never sees this key. Sending the provider-native tool entry in `tools` yourself is the equivalent long form and needs no `web_search`; send one or the other rather than both.\n\nBILLED. The `brave` backend runs as a separate search charge reported as `web_search_credits` on the response, on top of the completion's own tokens; the natively-grounded backends bill through the upstream provider's own search pricing.","properties":{"provider":{"type":"string","enum":["auto","brave","openai","gemini","anthropic"],"default":"auto","description":"Which search backend runs the query. `auto` (the default) derives it from the model family — `gpt-*`/`o*` → `openai`, `gemini*` → `gemini`, `claude*` → `anthropic` — and refuses with 400 `web_search_provider_required` for any other model, so a non-OpenAI/Google/Anthropic model must name a provider explicitly. `brave` is the decoupled path: the search runs first and its results are prepended to the conversation as a system message, and it is BILLED SEPARATELY from the completion (`web_search_credits` in the response). The other three are grounded natively by the upstream provider.","uniqueKey":"web_search.provider","typeLabel":"enum\u003cstring>"},"max_results":{"type":"integer","default":5,"description":"How many results to retrieve. Honoured on the `brave` path; the native grounded providers decide their own result count.","uniqueKey":"web_search.max_results","typeLabel":"integer"},"allowed_domains":{"type":"array","items":{"type":"string","uniqueKey":"web_search.allowed_domains.items.[INDEX]","typeLabel":"string"},"description":"Restrict results to these domains. Forwarded to Anthropic's native tool and honoured by the `brave` path; the OpenAI and Gemini grounded tools take no domain filter, so it is ignored there.","uniqueKey":"web_search.allowed_domains","typeLabel":"string[]"},"blocked_domains":{"type":"array","items":{"type":"string","uniqueKey":"web_search.blocked_domains.items.[INDEX]","typeLabel":"string"},"description":"Exclude these domains from results. Same reach as `allowed_domains`.","uniqueKey":"web_search.blocked_domains","typeLabel":"string[]"},"answer":{"type":"boolean","default":true,"description":"Ask the search backend for a synthesised answer alongside the raw results, where it offers one.","uniqueKey":"web_search.answer","typeLabel":"boolean"},"model":{"type":"string","description":"Search-backend-specific model override. Distinct from the top-level `model`, which is the chat model that consumes the results.","uniqueKey":"web_search.model","typeLabel":"string"}},"uniqueKey":"web_search","typeLabel":"object"}},"required":["model","messages"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!","name":"\u003cstring>","tool_call_id":"call_abc123","tool_calls":[{"id":"call_abc123","type":"function","function":{"name":"get_weather","arguments":"{\"location\":\"Paris\"}"}}]}],"temperature":1,"max_tokens":123,"top_p":0.5,"top_k":123,"presence_penalty":0,"frequency_penalty":0,"seed":123,"stream":false,"stop":"\u003cstring>","tools":[{"type":"function","function":{"name":"get_weather","description":"Get the current weather for a location.","parameters":{}}}],"response_format":{"type":"text"},"prompt_cache_key":"\u003cstring>","web_search":{"provider":"auto","max_results":5,"allowed_domains":["\u003cstring>"],"blocked_domains":["\u003cstring>"],"answer":true,"model":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"2ef01296-d13f-4f5f-8812-9921afb95584":{"description":"`stream=false` (default) returns `application/json` — a single chat-completion object, shown below. `stream=true` returns `text/event-stream`: a sequence of `data: \u003cjson>\\n\\n` lines terminated by a literal `data: [DONE]`. OpenAPI 3.0 has no way to describe a framed event stream, so the `text/event-stream` schema below describes the JSON payload of a SINGLE `data:` line (a `chat.completion.chunk`) — never the whole body. The final chunk before `[DONE]` carries `usage` and `credits_used` alongside an EMPTY `choices` array; every other chunk carries a non-empty `choices` with an incremental `delta`.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"chatcmpl-abc123","uniqueKey":"id","typeLabel":"string"},"object":{"type":"string","example":"chat.completion","uniqueKey":"object","typeLabel":"string"},"created":{"type":"integer","example":1713204900,"uniqueKey":"created","typeLabel":"integer"},"model":{"type":"string","example":"gpt-4o","uniqueKey":"model","typeLabel":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","example":0,"uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer"},"message":{"type":"object","properties":{"role":{"type":"string","example":"assistant","uniqueKey":"choices.items.[INDEX].message.role","typeLabel":"string"},"content":{"type":"string","example":"Hello! How can I help you today?","uniqueKey":"choices.items.[INDEX].message.content","typeLabel":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Tool call id. On a `tool` result message, echoed back as `tool_call_id`.","example":"call_abc123","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"example":"function","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"Function name the model wants to call.","example":"get_weather","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"JSON-encoded (stringified) arguments for the function call.","example":"{\"location\":\"Paris\"}","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"required":["name","arguments"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["id","type","function"],"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX]","typeLabel":"object"},"description":"Present when the model invokes tools. MAY CARRY SEVERAL: the non-streaming Responses-API translator numbers them `functionCallItems.map((f, i) => ({ index: i, ... }))`, and pass-through providers forward a model's native parallel calls untouched. Read every entry — an earlier version of this description claimed only one should be expected, and a consumer who believed it dropped calls the model actually made.","uniqueKey":"choices.items.[INDEX].message.tool_calls","typeLabel":"object[]"},"annotations":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["url_citation"],"example":"url_citation","description":"Always `url_citation` in practice — the translators filter out every other annotation type before attaching this array.","uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"url":{"type":"string","example":"https://example.com/article","uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX].url","typeLabel":"string"},"title":{"type":"string","example":"Example Article Title","uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX].title","typeLabel":"string"},"start_index":{"type":"integer","description":"Start offset (in the message text) the citation covers.","uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX].start_index","typeLabel":"integer"},"end_index":{"type":"integer","description":"End offset (in the message text) the citation covers.","uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX].end_index","typeLabel":"integer"}},"uniqueKey":"choices.items.[INDEX].message.annotations.items.[INDEX]","typeLabel":"object"},"description":"Web-search `url_citation` annotations (OpenAI-grounded chat only), attached by `responsesToChatCompletion` in `providers/openai-responses/response-translator.ts` when non-empty. See `ChatAnnotationDto`.","uniqueKey":"choices.items.[INDEX].message.annotations","typeLabel":"object[]"}},"uniqueKey":"choices.items.[INDEX].message","typeLabel":"object"},"finish_reason":{"type":"string","enum":["stop","length","tool_calls","content_filter"],"example":"stop","uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring>"}},"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices","typeLabel":"object[]"},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","example":42,"uniqueKey":"usage.prompt_tokens","typeLabel":"integer"},"completion_tokens":{"type":"integer","example":128,"uniqueKey":"usage.completion_tokens","typeLabel":"integer"},"total_tokens":{"type":"integer","example":170,"uniqueKey":"usage.total_tokens","typeLabel":"integer"}},"uniqueKey":"usage","typeLabel":"object"},"credits_used":{"type":"number","example":0.115,"description":"Credits deducted from the workspace balance for this request","uniqueKey":"credits_used","typeLabel":"number"},"web_search_credits":{"type":"number","example":0.4,"description":"Credits charged for the grounded web search this request performed, separate from `credits_used`, which covers the model call. Present only when a web-search provider actually ran.","uniqueKey":"web_search_credits","typeLabel":"number"},"infery_web_search":{"type":"object","description":"What the grounded search actually did. Present only when a web-search provider ran. The same object rides the final SSE chunk when streaming.","required":["provider","searches","citations"],"properties":{"provider":{"type":"string","example":"openai","description":"Which web-search provider served the grounding.","isRequired":true,"uniqueKey":"infery_web_search.provider","typeLabel":"string"},"searches":{"type":"integer","example":2,"description":"How many searches were performed — what `web_search_credits` was charged for.","isRequired":true,"uniqueKey":"infery_web_search.searches","typeLabel":"integer"},"citations":{"description":"Sources the answer was grounded in.","type":"array","items":{"type":"object","properties":{"url":{"type":"string","example":"https://example.com/article","description":"Source URL.","isRequired":true,"uniqueKey":"infery_web_search.citations.items.[INDEX].url","typeLabel":"string"},"title":{"type":"string","example":"An example article","description":"Source title as the provider reported it. Empty string when the provider gave none.","isRequired":true,"uniqueKey":"infery_web_search.citations.items.[INDEX].title","typeLabel":"string"}},"required":["url","title"],"uniqueKey":"infery_web_search.citations.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"infery_web_search.citations","typeLabel":"object[]"}},"uniqueKey":"infery_web_search","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"chatcmpl-abc123","object":"chat.completion","created":1713204900,"model":"gpt-4o","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! How can I help you today?","tool_calls":[{"id":"call_abc123","type":"function","function":{"name":"get_weather","arguments":"{\"location\":\"Paris\"}"}}],"annotations":[{"type":"url_citation","url":"https://example.com/article","title":"Example Article Title","start_index":123,"end_index":123}]},"finish_reason":"stop"}],"usage":{"prompt_tokens":42,"completion_tokens":128,"total_tokens":170},"credits_used":0.115,"web_search_credits":0.4,"infery_web_search":{"provider":"openai","searches":2,"citations":[{"url":"https://example.com/article","title":"An example article"}]}}}},"exampleType":"generated"},"text/event-stream":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"chatcmpl-abc123","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"object":{"type":"string","enum":["chat.completion.chunk"],"example":"chat.completion.chunk","isRequired":true,"uniqueKey":"object","typeLabel":"enum\u003cstring>"},"choices":{"description":"Empty on the usage-only and final `credits_used` chunks; one entry otherwise (the gateway is single-choice throughout).","type":"array","items":{"type":"object","properties":{"index":{"type":"integer","example":0,"isRequired":true,"uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer"},"delta":{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"example":"assistant","description":"Present only on the first chunk of the response.","uniqueKey":"choices.items.[INDEX].delta.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"A fragment of assistant text. Concatenate across chunks to reassemble the full message.","example":"Hello","uniqueKey":"choices.items.[INDEX].delta.content","typeLabel":"string"},"refusal":{"type":"string","description":"A fragment of a model refusal, in place of `content`.","uniqueKey":"choices.items.[INDEX].delta.refusal","typeLabel":"string"},"annotations":{"description":"Web-search `url_citation` annotations (OpenAI-grounded chat only). Attached, non-empty, to the delta of the FINAL content chunk by `ResponsesEventTranslator` — see `ChatAnnotationDto`.","type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["url_citation"],"example":"url_citation","description":"Always `url_citation` in practice — the translators filter out every other annotation type before attaching this array.","uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"url":{"type":"string","example":"https://example.com/article","uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX].url","typeLabel":"string"},"title":{"type":"string","example":"Example Article Title","uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX].title","typeLabel":"string"},"start_index":{"type":"integer","description":"Start offset (in the message text) the citation covers.","uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX].start_index","typeLabel":"integer"},"end_index":{"type":"integer","description":"End offset (in the message text) the citation covers.","uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX].end_index","typeLabel":"integer"}},"uniqueKey":"choices.items.[INDEX].delta.annotations.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices.items.[INDEX].delta.annotations","typeLabel":"object[]"},"tool_calls":{"description":"Present while the model is calling a tool. May carry SEVERAL calls, and one call's fragments arrive across chunks — group by `tool_calls[].index`, never by array position. See `ChatToolCallDto`'s doc comment.","type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Position of this tool call among the calls in progress. Accumulate `function.arguments` fragments PER INDEX — more than one call can be in flight, and the index is the only thing that separates them. See `ChatToolCallDto`'s doc comment.","example":0,"isRequired":true,"uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].index","typeLabel":"integer"},"id":{"type":"string","description":"Tool call id. Present only on the chunk that starts the call.","example":"call_abc123","uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"example":"function","description":"Present only on the chunk that starts the call.","uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"Function name. Present only on the chunk that starts a tool call.","example":"get_weather","uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"A fragment of the JSON-encoded arguments string. Concatenate across chunks (by `tool_calls[].index`) to reassemble the full arguments.","example":"{\"loc","uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["index"],"uniqueKey":"choices.items.[INDEX].delta.tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices.items.[INDEX].delta.tool_calls","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"choices.items.[INDEX].delta","typeLabel":"object"},"finish_reason":{"oneOf":[{"type":"string","enum":["stop","length","tool_calls","content_filter"],"example":null,"description":"`null` on every chunk but the last one for this choice.","uniqueKey":"choices.items.[INDEX].finish_reason.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","enum":["stop","length","tool_calls","content_filter"],"example":null,"description":"`null` on every chunk but the last one for this choice.","uniqueKey":"choices.items.[INDEX].finish_reason.oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring> | null"}},"required":["index","delta"],"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"choices","typeLabel":"object[]"},"created":{"type":"integer","example":1713204900,"description":"Unix timestamp. Absent on the final chunk of the generic streaming path (the one carrying `credits_used`) — see class doc comment.","uniqueKey":"created","typeLabel":"integer"},"model":{"type":"string","example":"gpt-4o","description":"Absent on the final chunk of the generic streaming path (the one carrying `credits_used`) — see class doc comment.","uniqueKey":"model","typeLabel":"string"},"usage":{"type":"object","description":"Present on the usage chunk(s) near the end of the stream — token counts for the whole request. On the FINAL chunk (empty `choices`), accompanied by `credits_used`.","required":["prompt_tokens","completion_tokens","total_tokens"],"properties":{"prompt_tokens":{"type":"integer","example":42,"isRequired":true,"uniqueKey":"usage.prompt_tokens","typeLabel":"integer"},"completion_tokens":{"type":"integer","example":128,"isRequired":true,"uniqueKey":"usage.completion_tokens","typeLabel":"integer"},"total_tokens":{"type":"integer","example":170,"isRequired":true,"uniqueKey":"usage.total_tokens","typeLabel":"integer"},"prompt_tokens_details":{"type":"object","description":"Omitted entirely when nothing was cached, so a non-caching stream is byte-wise unchanged from before caching support existed.","properties":{"cached_tokens":{"type":"integer","example":320,"description":"Subset of `prompt_tokens` served from cache, billed at a reduced rate.","uniqueKey":"usage.prompt_tokens_details.cached_tokens","typeLabel":"integer"},"cache_write_tokens":{"type":"integer","description":"Subset of `prompt_tokens` newly written to cache (default/5-minute TTL). OpenAI's own field, GPT-5.6 families onward.","uniqueKey":"usage.prompt_tokens_details.cache_write_tokens","typeLabel":"integer"},"cache_write_1h_tokens":{"type":"integer","description":"Subset of `prompt_tokens` written to cache at Anthropic's 1-hour TTL — infery's own extension to the OpenAI-shaped block.","uniqueKey":"usage.prompt_tokens_details.cache_write_1h_tokens","typeLabel":"integer"},"audio_tokens":{"type":"integer","description":"Subset of `prompt_tokens` that was audio input. Forwarded verbatim from upstream on audio-capable models — never set by gateway code.","uniqueKey":"usage.prompt_tokens_details.audio_tokens","typeLabel":"integer"}},"uniqueKey":"usage.prompt_tokens_details","typeLabel":"object"},"completion_tokens_details":{"type":"object","properties":{"reasoning_tokens":{"type":"integer","example":0,"description":"Subset of `completion_tokens` spent on hidden reasoning (o-series/thinking models).","uniqueKey":"usage.completion_tokens_details.reasoning_tokens","typeLabel":"integer"},"audio_tokens":{"type":"integer","description":"Subset of `completion_tokens` that was audio output. Forwarded verbatim from upstream on audio-capable models — never set by gateway code.","uniqueKey":"usage.completion_tokens_details.audio_tokens","typeLabel":"integer"}},"uniqueKey":"usage.completion_tokens_details","typeLabel":"object"}},"uniqueKey":"usage","typeLabel":"object"},"credits_used":{"type":"number","example":0.115,"description":"Credits deducted from the workspace balance for this request. Set only on the LAST chunk before `data: [DONE]`, alongside `usage` and an empty `choices` array — added in `chat.controller.ts`'s streaming handler once the credit hold is settled.","uniqueKey":"credits_used","typeLabel":"number"},"web_search_credits":{"type":"number","example":0.4,"description":"Credits charged for the grounded web search this request performed, SEPARATE from `credits_used`, which covers the model call. Present only when a web-search provider actually ran, on the same final chunk as `credits_used`. Undeclared until now, so a client generated from this document could not see half of what a grounded request cost.","uniqueKey":"web_search_credits","typeLabel":"number"},"infery_web_search":{"type":"object","description":"What the grounded search actually did, on the final chunk. Present only when a web-search provider ran. The same object appears on the non-streaming response body.","required":["provider","searches","citations"],"properties":{"provider":{"type":"string","example":"openai","description":"Which web-search provider served the grounding.","isRequired":true,"uniqueKey":"infery_web_search.provider","typeLabel":"string"},"searches":{"type":"integer","example":2,"description":"How many searches were performed — what `web_search_credits` was charged for.","isRequired":true,"uniqueKey":"infery_web_search.searches","typeLabel":"integer"},"citations":{"description":"Sources the answer was grounded in.","type":"array","items":{"type":"object","properties":{"url":{"type":"string","example":"https://example.com/article","description":"Source URL.","isRequired":true,"uniqueKey":"infery_web_search.citations.items.[INDEX].url","typeLabel":"string"},"title":{"type":"string","example":"An example article","description":"Source title as the provider reported it. Empty string when the provider gave none.","isRequired":true,"uniqueKey":"infery_web_search.citations.items.[INDEX].title","typeLabel":"string"}},"required":["url","title"],"uniqueKey":"infery_web_search.citations.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"infery_web_search.citations","typeLabel":"object[]"}},"uniqueKey":"infery_web_search","typeLabel":"object"}},"required":["id","object","choices"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello","refusal":"\u003cstring>","annotations":[{"type":"url_citation","url":"https://example.com/article","title":"Example Article Title","start_index":123,"end_index":123}],"tool_calls":[{"index":0,"id":"call_abc123","type":"function","function":{"name":"get_weather","arguments":"{\"loc"}}]},"finish_reason":null}],"created":1713204900,"model":"gpt-4o","usage":{"prompt_tokens":42,"completion_tokens":128,"total_tokens":170,"prompt_tokens_details":{"cached_tokens":320,"cache_write_tokens":123,"cache_write_1h_tokens":123,"audio_tokens":123},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":123}},"credits_used":0.115,"web_search_credits":0.4,"infery_web_search":{"provider":"openai","searches":2,"citations":[{"url":"https://example.com/article","title":"An example article"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"150bb477-983c-4995-846d-9e88c9eb1325":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"The error envelope. Every non-2xx response from this API has this shape, so a client can parse failures without branching on the endpoint.","required":["message","type","code","param"],"properties":{"message":{"type":"string","example":"Model not found","description":"Human-readable error message","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","example":"invalid_request_error","description":"Error category","enum":["invalid_request_error","authentication_error","permission_error","quota_exceeded","rate_limit_error","server_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"param":{"oneOf":[{"type":"string","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"job_id":{"type":"string","example":"job_1hR9xTPZqK4mVLc2nJ7fY5wB","description":"Handle to work that is ALREADY RUNNING AND ALREADY BILLED, present on the few errors that carry one. When it is here, this is not a failure to retry — retrying pays twice. Collect the result from `GET /v1/images/jobs/{job_id}`, which serves every durable media job regardless of modality.\n\nTwo situations produce it. A media generation that outruns the gateway's wait answers `504` with `code: \"job_timeout\"` and keeps working. And `POST /v1/audio/speech` answers **500** with `code: \"artifact_unreadable\"` when the speech was generated and settled but could not be read back from storage — the audio exists and is paid for; only this response failed.\n\nDeclared here rather than per-endpoint because the rule is about the FIELD, not the status: if this is present, there is a paid-for result to collect. It was undeclared until now, so a client generated from this document could not see the one field that recovers money already spent.","uniqueKey":"error.job_id","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"Model not found","type":"invalid_request_error","code":"model_not_found","param":"model","job_id":"job_1hR9xTPZqK4mVLc2nJ7fY5wB"}}}},"exampleType":"generated"}},"exampleType":"generated"},"bbeecfac-d9f5-46e4-b5c5-84478df87c18":{"description":"Unauthorized — invalid or missing API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"The error envelope. Every non-2xx response from this API has this shape, so a client can parse failures without branching on the endpoint.","required":["message","type","code","param"],"properties":{"message":{"type":"string","example":"Model not found","description":"Human-readable error message","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","example":"invalid_request_error","description":"Error category","enum":["invalid_request_error","authentication_error","permission_error","quota_exceeded","rate_limit_error","server_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"param":{"oneOf":[{"type":"string","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"job_id":{"type":"string","example":"job_1hR9xTPZqK4mVLc2nJ7fY5wB","description":"Handle to work that is ALREADY RUNNING AND ALREADY BILLED, present on the few errors that carry one. When it is here, this is not a failure to retry — retrying pays twice. Collect the result from `GET /v1/images/jobs/{job_id}`, which serves every durable media job regardless of modality.\n\nTwo situations produce it. A media generation that outruns the gateway's wait answers `504` with `code: \"job_timeout\"` and keeps working. And `POST /v1/audio/speech` answers **500** with `code: \"artifact_unreadable\"` when the speech was generated and settled but could not be read back from storage — the audio exists and is paid for; only this response failed.\n\nDeclared here rather than per-endpoint because the rule is about the FIELD, not the status: if this is present, there is a paid-for result to collect. It was undeclared until now, so a client generated from this document could not see the one field that recovers money already spent.","uniqueKey":"error.job_id","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"Model not found","type":"invalid_request_error","code":"model_not_found","param":"model","job_id":"job_1hR9xTPZqK4mVLc2nJ7fY5wB"}}}},"exampleType":"generated"}},"exampleType":"generated"},"ad01f309-d79f-4f9b-9081-a20f8eba2031":{"description":"Model not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"The error envelope. Every non-2xx response from this API has this shape, so a client can parse failures without branching on the endpoint.","required":["message","type","code","param"],"properties":{"message":{"type":"string","example":"Model not found","description":"Human-readable error message","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","example":"invalid_request_error","description":"Error category","enum":["invalid_request_error","authentication_error","permission_error","quota_exceeded","rate_limit_error","server_error"],"isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","example":"model_not_found","description":"Stable machine-readable error code. Branch on this rather than on `message`, which is prose and may be reworded.","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"param":{"oneOf":[{"type":"string","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","example":"model","description":"Name of the request parameter that triggered the error. `null` when the error is not attributable to one field.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"job_id":{"type":"string","example":"job_1hR9xTPZqK4mVLc2nJ7fY5wB","description":"Handle to work that is ALREADY RUNNING AND ALREADY BILLED, present on the few errors that carry one. When it is here, this is not a failure to retry — retrying pays twice. Collect the result from `GET /v1/images/jobs/{job_id}`, which serves every durable media job regardless of modality.\n\nTwo situations produce it. A media generation that outruns the gateway's wait answers `504` with `code: \"job_timeout\"` and keeps working. And `POST /v1/audio/speech` answers **500** with `code: \"artifact_unreadable\"` when the speech was generated and settled but could not be read back from storage — the audio exists and is paid for; only this response failed.\n\nDeclared here rather than per-endpoint because the rule is about the FIELD, not the status: if this is present, there is a paid-for result to collect. It was undeclared until now, so a client generated from this document could not see the one field that recovers money already spent.","uniqueKey":"error.job_id","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"Model not found","type":"invalid_request_error","code":"model_not_found","param":"model","job_id":"job_1hR9xTPZqK4mVLc2nJ7fY5wB"}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"2462593b-0ae9-45e0-8f61-1bf916b1035d":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"API key in format: Bearer inf_***","scopes":[]}}},"servers":{"70c58c78-558b-477f-817f-fa094a9f1354":{"url":"https://api.infery.ai","description":"Production"},"250da9ba-2678-444c-bc3b-e169d87db6d0":{"url":"http://localhost:3001","description":"Local"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"Authorization","description":"API key in format: Bearer inf_***","scopes":[]},"schema":{"title":"Authorization","type":"string","description":"API key in format: Bearer inf_***","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKey","name":"Authorization"}],"title":"ApiKey"}]},"originalFileLocation":"openapi.json"},"subdomain":"inferyai","siteName":"Infery.ai","title":"Chat completions - Infery.ai","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-28T18:35:10.438Z","originalFileLocation":"api-reference/chat-completions.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=\"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Infery.ai\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"index, follow\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_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/inferyai/nYe38cZ0EVrE-Nwe/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Chat completions - Infery.ai\">\u003cmeta data-mint-head property=\"og:description\" content=\"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Infery.ai Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.infery.ai/api-reference/chat-completions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.infery.ai/brand/og.jpg\">\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=\"Chat completions - Infery.ai\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.infery.ai/brand/og.jpg\">\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/inferyai/nYe38cZ0EVrE-Nwe/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Infery.ai\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2E5BE8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.infery.ai/api-reference/chat-completions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/chat-completions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.infery.ai/#organization\",\"name\":\"Infery.ai\",\"url\":\"https://docs.infery.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/inferyai/0Jgb47bSQtZI-re9/brand/logo-light.svg?fit=max\u0026auto=format\u0026n=0Jgb47bSQtZI-re9\u0026q=85\u0026s=d3ebed9120aa8e785f372aa43a7cccf3\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.infery.ai#website\",\"name\":\"Infery.ai\",\"url\":\"https://docs.infery.ai\",\"publisher\":{\"@id\":\"https://docs.infery.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.infery.ai/api-reference/chat-completions#webpage\",\"url\":\"https://docs.infery.ai/api-reference/chat-completions\",\"name\":\"Chat completions\",\"description\":\"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\",\"dateModified\":\"2026-08-28T18:35:10.438Z\",\"isPartOf\":{\"@id\":\"https://docs.infery.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.infery.ai/api-reference/chat-completions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.infery.ai/api-reference/chat-completions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Infery.ai\",\"item\":\"https://docs.infery.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat completions\",\"item\":\"https://docs.infery.ai/api-reference/chat-completions\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.infery.ai/api-reference/chat-completions#apireference\",\"headline\":\"Chat completions\",\"name\":\"Chat completions\",\"description\":\"POST /v1/chat/completions — OpenAI-compatible text and multimodal chat.\",\"url\":\"https://docs.infery.ai/api-reference/chat-completions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.infery.ai/api-reference/chat-completions#webpage\"},\"image\":\"https://docs.infery.ai/brand/og.jpg\",\"dateModified\":\"2026-08-28T18:35:10.438Z\",\"publisher\":{\"@id\":\"https://docs.infery.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.infery.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Infery.ai\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Infery.ai","nav":{"global":null,"tabs":[{"tab":"Guides","pages":[{"title":"Guides","href":"/introduction"}]},{"tab":"API Reference","groups":[{"group":"Overview","pages":[{"title":"API overview","href":"/api-reference/introduction"},{"title":"Authentication","href":"/api-reference/authentication"},{"title":"Errors","href":"/api-reference/errors"},{"title":"Rate limits","description":"Per-workspace and global rate limits, and what to do when you hit them.","href":"/api-reference/rate-limits"}]},{"group":"Chat Completions","pages":[{"title":"Chat completions","openapi":"openapi.json POST /v1/chat/completions","href":"/api-reference/chat-completions"}]},{"group":"Embeddings","pages":[{"title":"Embeddings","description":"POST /v1/embeddings — dense vector embeddings for text.","openapi":"openapi.json POST /v1/embeddings","href":"/api-reference/embeddings"}]},{"group":"Images","pages":[{"title":"Generate an image","openapi":"openapi.json POST /v1/images/generations","href":"/api-reference/images/generations"},{"title":"Edit an image","openapi":"openapi.json POST /v1/images/edits","href":"/api-reference/images/edits"},{"title":"Upscale an image","openapi":"openapi.json POST /v1/images/upscale","href":"/api-reference/images/upscale"}]},{"group":"Audio","pages":[{"title":"Text-to-speech","openapi":"openapi.json POST /v1/audio/speech","href":"/api-reference/audio/speech"},{"title":"Speech-to-text","openapi":"openapi.json POST /v1/audio/transcriptions","href":"/api-reference/audio/transcriptions"},{"title":"Transform audio","openapi":"openapi.json POST /v1/audio/transformations","href":"/api-reference/audio/transformations"}]},{"group":"Video","pages":[{"title":"Create video generation","openapi":"openapi.json POST /v1/videos/generations","href":"/api-reference/videos/generations"},{"title":"Get video generation status","openapi":"openapi.json GET /v1/videos/generations/{jobId}","href":"/api-reference/videos/status"},{"title":"Upscale a video","openapi":"openapi.json POST /v1/video/upscale","href":"/api-reference/videos/upscale"}]},{"group":"Music","pages":[{"title":"Music","openapi":"openapi.json POST /v1/music/generations","href":"/api-reference/music"}]},{"group":"Files","pages":[{"title":"Upload a file","openapi":"openapi.json POST /v1/files","href":"/api-reference/files/upload"},{"title":"List files","openapi":"openapi.json GET /v1/files","href":"/api-reference/files/list"},{"title":"Retrieve file metadata","openapi":"openapi.json GET /v1/files/{fileId}","href":"/api-reference/files/retrieve"},{"title":"Delete a file","openapi":"openapi.json DELETE /v1/files/{fileId}","href":"/api-reference/files/delete"},{"title":"Download file contents","openapi":"openapi.json GET /v1/files/{fileId}/content","href":"/api-reference/files/content"}]},{"group":"Models","pages":[{"title":"Models","openapi":"openapi.json GET /v1/models","href":"/api-reference/models"},{"title":"Estimate a model request","openapi":"openapi.json POST /v1/models/{slug}/estimate","href":"/api-reference/models-estimate"}]},{"group":"Capabilities","pages":[{"title":"List capabilities","openapi":"openapi.json GET /v1/tools","href":"/api-reference/tools"},{"title":"Run a capability","openapi":"openapi.json POST /v1/capabilities/{id}/run","href":"/api-reference/capabilities/run"},{"title":"Generate a 3D model","openapi":"openapi.json POST /v1/3d/generations","href":"/api-reference/3d/generations"}]},{"group":"Workflows","pages":[{"title":"Run a workflow","openapi":"openapi.json POST /v1/workflows/runs","href":"/api-reference/workflows/run"},{"title":"Retrieve a run","openapi":"openapi.json GET /v1/workflows/runs/{id}","href":"/api-reference/workflows/run-retrieve"},{"title":"Cancel a run","openapi":"openapi.json POST /v1/workflows/runs/{id}/cancel","href":"/api-reference/workflows/run-cancel"},{"title":"Run logs","openapi":"openapi.json GET /v1/workflows/runs/{id}/logs","href":"/api-reference/workflows/run-logs"},{"title":"Estimate a run","openapi":"openapi.json POST /v1/workflows/estimate","href":"/api-reference/workflows/estimate"},{"title":"Create a workflow","openapi":"openapi.json POST /v1/workflows","href":"/api-reference/workflows/create"},{"title":"List workflows","openapi":"openapi.json GET /v1/workflows","href":"/api-reference/workflows/list"},{"title":"Retrieve a workflow","openapi":"openapi.json GET /v1/workflows/{id}","href":"/api-reference/workflows/retrieve"},{"title":"Update a workflow","openapi":"openapi.json PUT /v1/workflows/{id}","href":"/api-reference/workflows/update"},{"title":"Delete a workflow","openapi":"openapi.json DELETE /v1/workflows/{id}","href":"/api-reference/workflows/delete"},{"title":"List templates","openapi":"openapi.json GET /v1/workflows/templates","href":"/api-reference/workflows/templates-list"},{"title":"Retrieve a template","openapi":"openapi.json GET /v1/workflows/templates/{slug}","href":"/api-reference/workflows/templates-retrieve"}]}]}]},"title":"Chat completions - Infery.ai","buildId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","deploymentId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-Bbp7I60D.js","utils-C3RIvJha.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DqD-vLt8.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-B31Loprg.js","snippetPresets-DKpk-b8t.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Cj65AhOR.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BXtn5gcC.js","shallow-RY2b03Cp.js","getApiPlaygroundDisplay-B0jeiPk3.js","CodeSnippet-CYgBjjwn.js","CodeSnippets-DOngDrYB.js","Page-n7I5XbKb.js","getPastedJson-DRQbJx-T.js","icon-CQiQCicY.js","MethodPill-BKTLdNtu.js","DuplicateIcon-B9jpAdat.js","createIcon-DCddRrXv.js","DynamicMarkdown-a8hUKrw6.js","SectionHeading-eECVV2eH.js","axios-vUo_bRtp.js","Markdown--GF7ZIpf.js","clsx-DZLdJUrt.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-2LoAhjKH.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-Zwc0ZncM.js"]}