Created
April 21, 2025 19:32
-
-
Save the-gigi/9f43bab825270c83bc2aa357fbb3844b to your computer and use it in GitHub Desktop.
OpenAI responses API
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en" class="light" data-theme="light" style="color-scheme: light;"><head> | |
<meta charset="utf-8"> | |
<link rel="icon" type="image/png" href="/favicon-platform.png"> | |
<link rel="icon" type="image/svg+xml" href="/favicon-platform.svg"> | |
<link rel="preconnect" href="https://cdn.openai.com"> | |
<link rel="preconnect" href="https://OWZ3QOIIJA-dsn.algolia.net" crossorigin=""> | |
<!-- Preload critical fonts --> | |
<link rel="preload" href="https://cdn.openai.com/common/fonts/openai-sans/OpenAISans-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous"> | |
<link rel="preload" href="https://cdn.openai.com/common/fonts/openai-sans/OpenAISans-Semibold.woff2" as="font" type="font/woff2" crossorigin="anonymous"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="theme-color" content="#000000"> | |
<title>API Reference - OpenAI API</title> | |
<meta name="description" content="Complete reference documentation for the OpenAI API, including examples and code snippets for our endpoints in Python, cURL, and Node.js."> | |
<link rel="manifest" href="/manifest.json"> | |
<!-- Facebook / LinkedIn Meta Tags --> | |
<meta property="og:title" content="API Reference - OpenAI API"> | |
<meta property="og:image" content="https://cdn.openai.com/API/images/platform-opengraph.png"> | |
<meta property="og:description" content="Complete reference documentation for the OpenAI API, including examples and code snippets for our endpoints in Python, cURL, and Node.js."> | |
<meta property="og:type" content="website"> | |
<meta property="og:url" content="https://platform.openai.com"> | |
<!-- Twitter Meta Tags --> | |
<meta name="twitter:card" content="summary_large_image"> | |
<meta property="twitter:domain" content="platform.openai.com"> | |
<meta property="twitter:url" content="https://platform.openai.com"> | |
<meta name="twitter:title" content="API Reference - OpenAI API"> | |
<meta name="twitter:description" content="Complete reference documentation for the OpenAI API, including examples and code snippets for our endpoints in Python, cURL, and Node.js."> | |
<meta name="twitter:image" content="https://cdn.openai.com/API/images/platform-opengraph.png"> | |
<script type="text/javascript" async="" src="https://widget.intercom.io/widget/dgkjq2bp"></script><script nonce="" type="module" crossorigin="" src="/static/index-K8zLN8eA.js"></script> | |
<link rel="stylesheet" crossorigin="" href="/static/rCM4AO41L0.css"> | |
<script nonce="" type="module">import.meta.url;import("_").catch(()=>1);(async function*(){})().next();if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script> | |
<script nonce="" type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script> | |
<link rel="modulepreload" as="script" crossorigin="" href="/static/xkDxmGDvHq.js"><link rel="modulepreload" as="script" crossorigin="" href="/static/Deb7m-64eQ.js"><link rel="stylesheet" href="/static/BL65ts2Al_.css"><link rel="modulepreload" as="script" crossorigin="" href="/static/B7LMOGwD-S.js"><link rel="stylesheet" href="/static/BIzaetRKef.css"><link rel="stylesheet" href="/static/BOJGmqj8x9.css"><link rel="modulepreload" as="script" crossorigin="" href="/static/CbQwZHaHFR.js"><link rel="modulepreload" as="script" crossorigin="" href="/static/Bu9zWjBANc.js"><link rel="modulepreload" as="script" crossorigin="" href="/static/CVZEYyA_Ou.js"><link rel="stylesheet" href="/static/CQrHNWQgoC.css"><link rel="modulepreload" as="script" crossorigin="" href="/static/yTxbZ1NxDB.js"><link rel="stylesheet" href="/static/BgOulL3cTO.css"></head> | |
<body> | |
<div id="root"><div class="rl7uK"><div class="hDvly"><div class="vpev1"><span class="block _6fZQu"><a class="qcq-H" href="/docs/overview"><svg fill="none" xmlns="http://www.w3.org/2000/svg" width="169" height="24" viewBox="0 0 169 24"><path d="M8.11 4.452C3.958 4.452.562 7.849.562 12c0 4.152 3.396 7.549 7.548 7.549 4.151 0 7.548-3.376 7.548-7.549A7.543 7.543 0 0 0 8.11 4.452Zm0 12.392c-2.58 0-4.655-2.118-4.655-4.844 0-2.725 2.076-4.843 4.655-4.843S12.765 9.275 12.765 12c0 2.726-2.076 4.844-4.655 4.844ZM23.29 8.645c-1.363 0-2.684.545-3.376 1.468V8.855h-2.726v14.677h2.726v-5.305c.692.86 1.971 1.321 3.376 1.321 2.935 0 5.242-2.306 5.242-5.451 0-3.145-2.307-5.452-5.242-5.452Zm-.461 8.534c-1.552 0-2.936-1.216-2.936-3.082 0-1.866 1.384-3.082 2.936-3.082 1.551 0 2.935 1.216 2.935 3.082 0 1.866-1.384 3.082-2.935 3.082ZM34.948 8.645c-2.977 0-5.325 2.328-5.325 5.452s2.054 5.451 5.41 5.451c2.746 0 4.507-1.656 5.052-3.522h-2.663c-.335.776-1.278 1.32-2.41 1.32-1.406 0-2.475-.985-2.727-2.39h7.926v-1.069c0-2.851-1.992-5.242-5.263-5.242Zm-2.642 4.382c.294-1.32 1.384-2.18 2.705-2.18 1.405 0 2.474.922 2.6 2.18h-5.305ZM47.466 8.645c-1.217 0-2.495.545-3.083 1.447V8.855h-2.725v10.484h2.725v-5.64c0-1.636.881-2.705 2.307-2.705 1.32 0 2.034 1.006 2.034 2.41v5.935h2.725v-6.374c0-2.6-1.593-4.32-3.983-4.32ZM58.43 4.662l-5.933 14.677h2.914l1.258-3.208h6.752l1.258 3.208h2.956L61.743 4.662H58.43Zm-.817 9.037 2.432-6.144 2.411 6.144h-4.843ZM71.514 4.662h-2.768v14.677h2.768V4.662ZM93.11 4.661h-6.5v14.677h2.768v-5.514h3.753c2.894 0 4.948-1.698 4.948-4.55 0-2.851-2.054-4.613-4.969-4.613Zm-.188 6.73h-3.544V7.178h3.544c1.425 0 2.348.818 2.348 2.097 0 1.28-.923 2.118-2.348 2.118ZM102.399 4.661h-2.726v14.677h2.726V4.661ZM113.575 12.502c0-2.39-1.636-3.858-4.655-3.858-2.474 0-4.445 1.384-4.781 3.397h2.748c.209-.692.963-1.237 2.012-1.237 1.363 0 2.013.713 2.013 1.95v.063l-2.663.23c-2.789.231-4.34 1.364-4.34 3.502 0 1.803 1.551 2.998 3.711 2.998 1.447 0 2.851-.566 3.439-1.51 0 .462.042.881.126 1.3h2.537c-.106-.67-.147-1.446-.147-2.348v-4.487Zm-2.663 2.495c0 1.238-.923 2.496-2.789 2.496-1.006 0-1.551-.483-1.551-1.195 0-.776.524-1.258 1.698-1.363l2.642-.231v.293ZM119.298 5.457h-2.725v3.397h-2.18v2.201h2.18v5.158c0 1.992 1.027 3.124 3.229 3.124h2.18v-2.264h-1.383c-.923 0-1.301-.314-1.301-1.174v-4.844h2.684V8.854h-2.684V5.457ZM127.811 8.142c0-.755.336-1.216 1.259-1.216h1.95V4.66h-2.306c-2.37 0-3.628 1.216-3.628 3.23v.964h-2.18v2.201h2.18v8.282h2.725v-8.282h2.685V8.855h-2.685v-.713ZM136.428 8.645c-3.123 0-5.535 2.474-5.535 5.451 0 2.977 2.412 5.451 5.535 5.451 3.124 0 5.536-2.474 5.536-5.451 0-2.977-2.412-5.451-5.536-5.451Zm0 8.47c-1.446 0-2.831-1.174-2.831-3.019 0-1.845 1.385-3.02 2.831-3.02 1.447 0 2.831 1.175 2.831 3.02s-1.384 3.02-2.831 3.02ZM146.115 10.448V8.855h-2.704V19.34h2.725v-4.97c0-1.991 1.006-2.998 2.789-2.998h.839V8.73h-.545c-1.321 0-2.559.65-3.104 1.72ZM163.854 8.645c-1.636 0-2.873.629-3.627 1.76-.651-1.11-1.845-1.76-3.23-1.76-1.3 0-2.474.545-3.061 1.446V8.854h-2.726v10.484h2.726v-5.64c0-1.636.86-2.705 2.265-2.705 1.299 0 2.013 1.006 2.013 2.411v5.934h2.725v-5.64c0-1.636.88-2.705 2.265-2.705 1.3 0 2.013 1.006 2.013 2.411v5.934h2.725v-6.374c0-2.6-1.656-4.32-4.088-4.32Z" fill="var(--text-primary)"></path></svg></a></span></div><div class="Aip-a"><div class="zWMrv"><span class="block"><div class="zWMrv"><nav class="okBd0"><a class="w9s17" data-primary-nav-item="" href="/docs"><span class="EsOWR vaD2P" data-title="Docs">Docs</span><span class="EsOWR ksWxL" data-title="Docs">Docs</span></a><a aria-current="page" class="w9s17 _1T-tk" data-primary-nav-item="" href="/docs/api-reference/introduction"><span class="EsOWR vaD2P" data-title="API reference">API reference</span><span class="EsOWR ksWxL" data-title="API">API</span></a></nav></div></span><div class="flex gap-3 mt-3 md:mt-0"><button type="button" class="Wmjjd" data-color="secondary" data-variant="filled" data-size="md" data-gutter-size="md" data-icon-size="md" data-block="" style="--scale: 0.96;"><span class="_6jr41">Log in</span></button><a class="Wmjjd" data-color="primary" data-variant="filled" data-size="md" data-gutter-size="md" data-icon-size="md" data-block="" href="/signup"><span class="_6jr41">Sign up</span></a></div></div></div><div class="_3fO9I"><svg fill="none" xmlns="http://www.w3.org/2000/svg" width="169" height="24" viewBox="0 0 169 24"><path d="M8.11 4.452C3.958 4.452.562 7.849.562 12c0 4.152 3.396 7.549 7.548 7.549 4.151 0 7.548-3.376 7.548-7.549A7.543 7.543 0 0 0 8.11 4.452Zm0 12.392c-2.58 0-4.655-2.118-4.655-4.844 0-2.725 2.076-4.843 4.655-4.843S12.765 9.275 12.765 12c0 2.726-2.076 4.844-4.655 4.844ZM23.29 8.645c-1.363 0-2.684.545-3.376 1.468V8.855h-2.726v14.677h2.726v-5.305c.692.86 1.971 1.321 3.376 1.321 2.935 0 5.242-2.306 5.242-5.451 0-3.145-2.307-5.452-5.242-5.452Zm-.461 8.534c-1.552 0-2.936-1.216-2.936-3.082 0-1.866 1.384-3.082 2.936-3.082 1.551 0 2.935 1.216 2.935 3.082 0 1.866-1.384 3.082-2.935 3.082ZM34.948 8.645c-2.977 0-5.325 2.328-5.325 5.452s2.054 5.451 5.41 5.451c2.746 0 4.507-1.656 5.052-3.522h-2.663c-.335.776-1.278 1.32-2.41 1.32-1.406 0-2.475-.985-2.727-2.39h7.926v-1.069c0-2.851-1.992-5.242-5.263-5.242Zm-2.642 4.382c.294-1.32 1.384-2.18 2.705-2.18 1.405 0 2.474.922 2.6 2.18h-5.305ZM47.466 8.645c-1.217 0-2.495.545-3.083 1.447V8.855h-2.725v10.484h2.725v-5.64c0-1.636.881-2.705 2.307-2.705 1.32 0 2.034 1.006 2.034 2.41v5.935h2.725v-6.374c0-2.6-1.593-4.32-3.983-4.32ZM58.43 4.662l-5.933 14.677h2.914l1.258-3.208h6.752l1.258 3.208h2.956L61.743 4.662H58.43Zm-.817 9.037 2.432-6.144 2.411 6.144h-4.843ZM71.514 4.662h-2.768v14.677h2.768V4.662ZM93.11 4.661h-6.5v14.677h2.768v-5.514h3.753c2.894 0 4.948-1.698 4.948-4.55 0-2.851-2.054-4.613-4.969-4.613Zm-.188 6.73h-3.544V7.178h3.544c1.425 0 2.348.818 2.348 2.097 0 1.28-.923 2.118-2.348 2.118ZM102.399 4.661h-2.726v14.677h2.726V4.661ZM113.575 12.502c0-2.39-1.636-3.858-4.655-3.858-2.474 0-4.445 1.384-4.781 3.397h2.748c.209-.692.963-1.237 2.012-1.237 1.363 0 2.013.713 2.013 1.95v.063l-2.663.23c-2.789.231-4.34 1.364-4.34 3.502 0 1.803 1.551 2.998 3.711 2.998 1.447 0 2.851-.566 3.439-1.51 0 .462.042.881.126 1.3h2.537c-.106-.67-.147-1.446-.147-2.348v-4.487Zm-2.663 2.495c0 1.238-.923 2.496-2.789 2.496-1.006 0-1.551-.483-1.551-1.195 0-.776.524-1.258 1.698-1.363l2.642-.231v.293ZM119.298 5.457h-2.725v3.397h-2.18v2.201h2.18v5.158c0 1.992 1.027 3.124 3.229 3.124h2.18v-2.264h-1.383c-.923 0-1.301-.314-1.301-1.174v-4.844h2.684V8.854h-2.684V5.457ZM127.811 8.142c0-.755.336-1.216 1.259-1.216h1.95V4.66h-2.306c-2.37 0-3.628 1.216-3.628 3.23v.964h-2.18v2.201h2.18v8.282h2.725v-8.282h2.685V8.855h-2.685v-.713ZM136.428 8.645c-3.123 0-5.535 2.474-5.535 5.451 0 2.977 2.412 5.451 5.535 5.451 3.124 0 5.536-2.474 5.536-5.451 0-2.977-2.412-5.451-5.536-5.451Zm0 8.47c-1.446 0-2.831-1.174-2.831-3.019 0-1.845 1.385-3.02 2.831-3.02 1.447 0 2.831 1.175 2.831 3.02s-1.384 3.02-2.831 3.02ZM146.115 10.448V8.855h-2.704V19.34h2.725v-4.97c0-1.991 1.006-2.998 2.789-2.998h.839V8.73h-.545c-1.321 0-2.559.65-3.104 1.72ZM163.854 8.645c-1.636 0-2.873.629-3.627 1.76-.651-1.11-1.845-1.76-3.23-1.76-1.3 0-2.474.545-3.061 1.446V8.854h-2.726v10.484h2.726v-5.64c0-1.636.86-2.705 2.265-2.705 1.299 0 2.013 1.006 2.013 2.411v5.934h2.725v-5.64c0-1.636.88-2.705 2.265-2.705 1.3 0 2.013 1.006 2.013 2.411v5.934h2.725v-6.374c0-2.6-1.656-4.32-4.088-4.32Z" fill="var(--text-primary)"></path></svg></div></div><main class="unjkE" data-sidebar="expanded" data-mobile-menu="hidden"><aside class="EpwGB"><div class="GVIPA"><div class="JGDzZ"><div class="fKGG4"><div class="NmUvH"><span class="block _00hoS"><div class="aTuAl"><div class="_0MyKb qyrrQ"><div class="search mt-[-6px]"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key">⌘</kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div></div><div class="DH-HY qyrrQ QeXPj"><div class="side-nav-section"><div class="side-nav-header subheading">API Reference</div><a class="scroll-link side-nav-item" href="/docs/api-reference/introduction"><span class="side-nav-item-name">Introduction</span></a><a class="scroll-link side-nav-item" href="/docs/api-reference/authentication"><span class="side-nav-item-name">Authentication</span></a><a class="scroll-link side-nav-item" href="/docs/api-reference/debugging-requests"><span class="side-nav-item-name">Debugging requests</span></a><a class="scroll-link side-nav-item" href="/docs/api-reference/backward-compatibility"><span class="side-nav-item-name">Backward compatibility</span></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Responses</div><a class="scroll-link side-nav-item side-nav-item-has-subitems active active-exact" data-side-nav-subitems="visible" href="/docs/api-reference/responses"><span class="side-nav-item-name">Responses</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><div class="side-nav-subitems"><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/create"><span class="side-nav-item-name">Create a model response</span></a><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/get"><span class="side-nav-item-name">Get a model response</span></a><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/delete"><span class="side-nav-item-name">Delete a model response</span></a><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/input-items"><span class="side-nav-item-name">List input items</span></a><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/object"><span class="side-nav-item-name">The response object</span></a><a class="scroll-link side-nav-item side-nav-child" href="/docs/api-reference/responses/list"><span class="side-nav-item-name">The input item list</span></a></div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/responses-streaming"><span class="side-nav-item-name">Streaming</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Chat Completions</div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/chat"><span class="side-nav-item-name">Chat Completions</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/chat-streaming"><span class="side-nav-item-name">Streaming</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Realtime <div class="qB3Oq" data-color="warning" data-size="sm" data-variant="filled"><span class="BWpH-" data-size="sm">Beta</span></div></div><a class="scroll-link side-nav-item" href="/docs/api-reference/realtime"><span class="side-nav-item-name">Realtime</span></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/realtime-sessions"><span class="side-nav-item-name">Session tokens</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/realtime-client-events"><span class="side-nav-item-name">Client events</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/realtime-server-events"><span class="side-nav-item-name">Server events</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Platform APIs</div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/audio"><span class="side-nav-item-name">Audio</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/embeddings"><span class="side-nav-item-name">Embeddings</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/evals"><span class="side-nav-item-name">Evals</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/fine-tuning"><span class="side-nav-item-name">Fine-tuning</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/batch"><span class="side-nav-item-name">Batch</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/files"><span class="side-nav-item-name">Files</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/uploads"><span class="side-nav-item-name">Uploads</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/images"><span class="side-nav-item-name">Images</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/models"><span class="side-nav-item-name">Models</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/moderations"><span class="side-nav-item-name">Moderations</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Vector stores</div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/vector-stores"><span class="side-nav-item-name">Vector stores</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/vector-stores-files"><span class="side-nav-item-name">Vector store files</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/vector-stores-file-batches"><span class="side-nav-item-name">Vector store file batches</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Assistants <div class="qB3Oq" data-color="warning" data-size="sm" data-variant="filled"><span class="BWpH-" data-size="sm">Beta</span></div></div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/assistants"><span class="side-nav-item-name">Assistants</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/threads"><span class="side-nav-item-name">Threads</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/messages"><span class="side-nav-item-name">Messages</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/runs"><span class="side-nav-item-name">Runs</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/run-steps"><span class="side-nav-item-name">Run steps</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/assistants-streaming"><span class="side-nav-item-name">Streaming</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Administration</div><a class="scroll-link side-nav-item" href="/docs/api-reference/administration"><span class="side-nav-item-name">Administration</span></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/admin-api-keys"><span class="side-nav-item-name">Admin API Keys</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/invite"><span class="side-nav-item-name">Invites</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/users"><span class="side-nav-item-name">Users</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/projects"><span class="side-nav-item-name">Projects</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/project-users"><span class="side-nav-item-name">Project users</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/project-service-accounts"><span class="side-nav-item-name">Project service accounts</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/project-api-keys"><span class="side-nav-item-name">Project API keys</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/project-rate-limits"><span class="side-nav-item-name">Project rate limits</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/audit-logs"><span class="side-nav-item-name">Audit logs</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/usage"><span class="side-nav-item-name">Usage</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/certificates"><span class="side-nav-item-name">Certificates</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div><div class="side-nav-section"><div class="side-nav-header subheading">Legacy</div><a class="scroll-link side-nav-item side-nav-item-has-subitems" data-side-nav-subitems="hidden" href="/docs/api-reference/completions"><span class="side-nav-item-name">Completions</span><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24" class="side-nav-mobile-chevron"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg></a></div></div></div></span></div></div></div></div><div class="EDOEc qyrrQ"><div class="q3jBs"><a href="https://cookbook.openai.com" target="_blank" rel="noopener noreferrer" class="-ySo1 FDGXZ" data-state="closed"><span class="_1h-SG"><span class="-k7Gw"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M14.447 7.106a1 1 0 0 1 .447 1.341l-4 8a1 1 0 1 1-1.788-.894l4-8a1 1 0 0 1 1.341-.447ZM6.6 7.2a1 1 0 0 1 .2 1.4L4.25 12l2.55 3.4a1 1 0 0 1-1.6 1.2l-3-4a1 1 0 0 1 0-1.2l3-4a1 1 0 0 1 1.4-.2Zm10.8 0a1 1 0 0 1 1.4.2l3 4a1 1 0 0 1 0 1.2l-3 4a1 1 0 0 1-1.6-1.2l2.55-3.4-2.55-3.4a1 1 0 0 1 .2-1.4Z" clip-rule="evenodd"></path></svg></span><span class="_0LIzz">Cookbook</span></span></a><a href="https://community.openai.com/categories" target="_blank" rel="noopener noreferrer" class="-ySo1 FDGXZ" data-state="closed"><span class="_1h-SG"><span class="-k7Gw"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M10.5 8.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12 5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7ZM3 9.5a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-3a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm16 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-3 1a3 3 0 1 1 6 0 3 3 0 0 1-6 0ZM8 18c0-.974.438-1.684 1.142-2.185C9.876 15.293 10.911 15 12 15c1.09 0 2.124.293 2.858.815.704.5 1.142 1.21 1.142 2.185a1 1 0 1 0 2 0c0-1.692-.812-2.982-1.983-3.815C14.876 13.373 13.411 13 12 13c-1.41 0-2.876.373-4.017 1.185C6.812 15.018 6 16.308 6 18a1 1 0 1 0 2 0Zm-3.016-3.675a1 1 0 0 1-.809 1.16C2.79 15.732 2 16.486 2 17.5a1 1 0 1 1-2 0c0-2.41 1.978-3.655 3.825-3.985a1 1 0 0 1 1.16.81Zm14.84 1.16a1 1 0 1 1 .351-1.97C22.022 13.845 24 15.09 24 17.5a1 1 0 1 1-2 0c0-1.014-.79-1.768-2.175-2.015Z" clip-rule="evenodd"></path></svg></span><span class="_0LIzz">Forum</span></span></a><button class="-ySo1 FDGXZ" data-state="closed"><span class="_1h-SG"><span class="-k7Gw"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M12 9a1 1 0 0 0-.879.522 1 1 0 0 1-1.754-.96A3 3 0 0 1 12 7c1.515 0 2.567 1.006 2.866 2.189.302 1.189-.156 2.574-1.524 3.258A.618.618 0 0 0 13 13a1 1 0 1 1-2 0c0-.992.56-1.898 1.447-2.342.455-.227.572-.618.48-.978C12.836 9.314 12.529 9 12 9Z" clip-rule="evenodd"></path><path d="M13.1 16a1.1 1.1 0 1 1-2.2 0 1.1 1.1 0 0 1 2.2 0Z"></path></svg></span><span class="_0LIzz">Help</span></span></button></div></div></aside><div class="_7j8ow"><div class="qLnXc"><div class="JGDzZ"><div class="fKGG4"><div class="NmUvH"><span class="block _00hoS"><div class="ImBcX"><div class="docs-scroll-container" data-important-algolia-crawl="true"><div class="page-body full-width flush docs-page"><div class="api-ref"><div class="section md"><div class="docs-markdown-content"><div class="anchor-heading-wrapper"><h2 id="introduction" class="anchor-heading" data-name="introduction">Introduction<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div> | |
<p>This API reference describes the RESTful, streaming, and realtime APIs you can use to interact with the OpenAI platform. REST APIs are usable via HTTP in any environment that supports HTTP requests. Language-specific SDKs are listed <a href="/docs/libraries">on the libraries page</a>.</p></div></div><div class="section md"><div class="docs-markdown-content"><div class="anchor-heading-wrapper"><h2 id="authentication" class="anchor-heading" data-name="authentication">Authentication<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div> | |
<p>The OpenAI API uses API keys for authentication. Create, manage, and learn more about API keys in your <a href="/settings/organization/api-keys">organization settings</a>.</p> | |
<p><strong>Remember that your API key is a secret!</strong> Do not share it with others or expose it in any client-side code (browsers, apps). API keys should be securely loaded from an environment variable or key management service on the server.</p> | |
<p>API keys should be provided via <a href="https://swagger.io/docs/specification/v3_0/authentication/bearer-authentication/" target="_blank" rel="noopener noreferrer">HTTP Bearer authentication</a>.</p> | |
<div class="code-sample code-sample-oneliner light-mode"><div class="code-sample-body code-sample-body-large"><div class="code-sample-copy-float"><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><span><span>Authorization: Bearer OPENAI_API_KEY</span></span></code></pre></div></div> | |
<p>If you belong to multiple organizations or access projects through a legacy user API key, pass a header to specify which organization and project to use for an API request:</p> | |
<div class="code-sample light-mode"><div class="code-sample-body code-sample-body-large"><div class="code-sample-copy-float"><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>curl https://api.openai.com/v1/models \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"OpenAI-Organization: YOUR_ORG_ID"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"OpenAI-Project: </span><span class="hljs-string hljs-variable">$PROJECT_ID</span><span class="hljs-string">"</span></span></code></pre></div></div> | |
<p>Usage from these API requests counts as usage for the specified organization and project.Organization IDs can be found on your <a href="/settings/organization/general">organization settings</a> page. | |
Project IDs can be found on your <a href="/settings">general settings</a> page by selecting the specific project.</p></div></div><div class="section md"><div class="docs-markdown-content"><div class="anchor-heading-wrapper"><h2 id="debugging-requests" class="anchor-heading" data-name="debugging-requests">Debugging requests<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div> | |
<p>In addition to <a href="/docs/guides/error-codes">error codes</a> returned from API responses, you can inspect HTTP response headers containing the unique ID of a particular API request or information about rate limiting applied to your requests. Below is an incomplete list of HTTP headers returned with API responses:</p> | |
<p><strong>API meta information</strong></p> | |
<ul> | |
<li><code>openai-organization</code>: The <a href="/docs/guides/production-best-practices#setting-up-your-organization">organization</a> associated with the request</li> | |
<li><code>openai-processing-ms</code>: Time taken processing your API request</li> | |
<li><code>openai-version</code>: REST API version used for this request (currently <code>2020-10-01</code>)</li> | |
<li><code>x-request-id</code>: Unique identifier for this API request (used in troubleshooting)</li> | |
</ul> | |
<p><strong><a href="/docs/guides/rate-limits">Rate limiting information</a></strong></p> | |
<ul> | |
<li><code>x-ratelimit-limit-requests</code></li> | |
<li><code>x-ratelimit-limit-tokens</code></li> | |
<li><code>x-ratelimit-remaining-requests</code></li> | |
<li><code>x-ratelimit-remaining-tokens</code></li> | |
<li><code>x-ratelimit-reset-requests</code></li> | |
<li><code>x-ratelimit-reset-tokens</code></li> | |
</ul> | |
<p><strong>OpenAI recommends logging request IDs in production deployments</strong> for more efficient troubleshooting with our <a href="https://help.openai.com/en/" target="_blank" rel="noopener noreferrer">support team</a>, should the need arise. Our <a href="/docs/libraries">official SDKs</a> provide a property on top-level response objects containing the value of the <code>x-request-id</code> header.</p></div></div><div class="section md"><div class="docs-markdown-content"><div class="anchor-heading-wrapper"><h2 id="backward-compatibility" class="anchor-heading" data-name="backward-compatibility">Backward compatibility<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div> | |
<p>OpenAI is committed to providing stability to API users by avoiding breaking changes in major API versions whenever reasonably possible. This includes:</p> | |
<ul> | |
<li>The REST API (currently <code>v1</code>)</li> | |
<li>Our first-party <a href="/docs/libraries">SDKs</a> (released SDKs adhere to <a href="https://semver.org/" target="_blank" rel="noopener noreferrer">semantic versioning</a>)</li> | |
<li><a href="/docs/models">Model</a> families (like <code>gpt-4o</code> or <code>o4-mini</code>)</li> | |
</ul> | |
<p><strong>Model prompting behavior between snapshots is subject to change</strong>. | |
Model outputs are by their nature variable, so expect changes in prompting and model behavior between snapshots. For example, if you moved from <code>gpt-4o-2024-05-13</code> to <code>gpt-4o-2024-08-06</code>, the same <code>system</code> or <code>user</code> messages could function differently between versions. The best way to ensure consistent prompting behavior and model output is to use pinned model versions, and to implement <a href="/docs/guides/evals">evals</a> for your applications.</p> | |
<p><strong>Backwards-compatible API changes</strong>:</p> | |
<ul> | |
<li>Adding new resources (URLs) to the REST API and SDKs</li> | |
<li>Adding new optional API parameters</li> | |
<li>Adding new properties to JSON response objects or event data</li> | |
<li>Changing the order of properties in a JSON response object</li> | |
<li>Changing the length or format of opaque strings, like resource identifiers and UUIDs</li> | |
<li>Adding new event types (in either streaming or the Realtime API)</li> | |
</ul> | |
<p>See the <a href="/docs/changelog">changelog</a> for a list of backwards-compatible changes and rare breaking changes.</p></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="responses" class="anchor-heading" data-name="responses"><div class="flex flex-row items-center gap-3">Responses</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>OpenAI's most advanced interface for generating model responses. Supports | |
text and image inputs, and text outputs. Create stateful interactions | |
with the model, using the output of previous responses as input. Extend | |
the model's capabilities with built-in tools for file search, web search, | |
computer use, and more. Allow the model access to external systems and data | |
using function calling.</p> | |
<p>Related guides:</p> | |
<ul> | |
<li><a href="/docs/quickstart?api-mode=responses">Quickstart</a></li> | |
<li><a href="/docs/guides/text?api-mode=responses">Text inputs and outputs</a></li> | |
<li><a href="/docs/guides/images?api-mode=responses">Image inputs</a></li> | |
<li><a href="/docs/guides/structured-outputs?api-mode=responses">Structured Outputs</a></li> | |
<li><a href="/docs/guides/function-calling?api-mode=responses">Function calling</a></li> | |
<li><a href="/docs/guides/conversation-state?api-mode=responses">Conversation state</a></li> | |
<li><a href="/docs/guides/tools?api-mode=responses">Extend the models with tools</a></li> | |
</ul></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/create" class="anchor-heading" data-name="responses/create"><div class="flex flex-row items-center gap-3">Create a model response</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-post">post</span> <span class="endpoint-path">https://api.openai.com/v1/responses</span></span></div><div class="endpoint-summary"><p>Creates a model response. Provide <a href="/docs/guides/text">text</a> or | |
<a href="/docs/guides/images">image</a> inputs to generate <a href="/docs/guides/text">text</a> | |
or <a href="/docs/guides/structured-outputs">JSON</a> outputs. Have the model call | |
your own <a href="/docs/guides/function-calling">custom code</a> or use built-in | |
<a href="/docs/guides/tools">tools</a> like <a href="/docs/guides/tools-web-search">web search</a> | |
or <a href="/docs/guides/tools-file-search">file search</a> to use your own data | |
as input for the model's response.</p></div><div class="param-section"><h4>Request body</h4><div class="param-table" id="responses-create__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-input" data-anchor="responses-create-input" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input</div><div class="param-type"><div class="docs-markdown-content"><p>string or array</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Text, image, or file inputs to the model, used to generate a response.</p> | |
<p>Learn more:</p> | |
<ul> | |
<li><a href="/docs/guides/text">Text inputs and outputs</a></li> | |
<li><a href="/docs/guides/images">Image inputs</a></li> | |
<li><a href="/docs/guides/pdf-files">File inputs</a></li> | |
<li><a href="/docs/guides/conversation-state">Conversation state</a></li> | |
<li><a href="/docs/guides/function-calling">Function calling</a></li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-create-input_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-model" data-anchor="responses-create-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Model ID used to generate the response, like <code>gpt-4o</code> or <code>o3</code>. OpenAI | |
offers a wide range of models with different capabilities, performance | |
characteristics, and price points. Refer to the <a href="/docs/models">model guide</a> | |
to browse and compare available models.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-include" data-anchor="responses-create-include" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">include</div><div class="param-type"><div class="docs-markdown-content"><p>array or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specify additional output data to include in the model response. Currently | |
supported values are:</p> | |
<ul> | |
<li><code>file_search_call.results</code>: Include the search results of | |
the file search tool call.</li> | |
<li><code>message.input_image.image_url</code>: Include image urls from the input message.</li> | |
<li><code>computer_call_output.output.image_url</code>: Include image urls from the computer call output.</li> | |
</ul></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-instructions" data-anchor="responses-create-instructions" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">instructions</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Inserts a system (or developer) message as the first item in the model's context.</p> | |
<p>When using along with <code>previous_response_id</code>, the instructions from a previous | |
response will not be carried over to the next response. This makes it simple | |
to swap out system (or developer) messages in new responses.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-max_output_tokens" data-anchor="responses-create-max_output_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_output_tokens</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An upper bound for the number of tokens that can be generated for a response, including visible output tokens and <a href="/docs/guides/reasoning">reasoning tokens</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-metadata" data-anchor="responses-create-metadata" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">metadata</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Set of 16 key-value pairs that can be attached to an object. This can be | |
useful for storing additional information about the object in a structured | |
format, and querying for objects via API or the dashboard.</p> | |
<p>Keys are strings with a maximum length of 64 characters. Values are strings | |
with a maximum length of 512 characters.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-parallel_tool_calls" data-anchor="responses-create-parallel_tool_calls" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">parallel_tool_calls</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to true</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether to allow the model to run tool calls in parallel.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-previous_response_id" data-anchor="responses-create-previous_response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">previous_response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the previous response to the model. Use this to | |
create multi-turn conversations. Learn more about | |
<a href="/docs/guides/conversation-state">conversation state</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-reasoning" data-anchor="responses-create-reasoning" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">reasoning</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p><strong>o-series models only</strong></p> | |
<p>Configuration options for | |
<a href="https://platform.openai.com/docs/guides/reasoning" target="_blank" rel="noopener noreferrer">reasoning models</a>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-create-reasoning_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-service_tier" data-anchor="responses-create-service_tier" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">service_tier</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to auto</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:</p> | |
<ul> | |
<li>If set to 'auto', and the Project is Scale tier enabled, the system | |
will utilize scale tier credits until they are exhausted.</li> | |
<li>If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'flex', the request will be processed with the Flex Processing service tier. <a href="/docs/guides/flex-processing">Learn more</a>.</li> | |
<li>When not set, the default behavior is 'auto'.</li> | |
</ul> | |
<p>When this parameter is set, the response body will include the <code>service_tier</code> utilized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-store" data-anchor="responses-create-store" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">store</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to true</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether to store the generated model response for later retrieval via | |
API.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-stream" data-anchor="responses-create-stream" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">stream</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to false</div></div><div class="param-desc"><div class="docs-markdown-content"><p>If set to true, the model response data will be streamed to the client | |
as it is generated using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format" target="_blank" rel="noopener noreferrer">server-sent events</a>. | |
See the <a href="/docs/api-reference/responses-streaming">Streaming section below</a> | |
for more information.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-temperature" data-anchor="responses-create-temperature" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">temperature</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 1</div></div><div class="param-desc"><div class="docs-markdown-content"><p>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | |
We generally recommend altering this or <code>top_p</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-text" data-anchor="responses-create-text" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">text</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration options for a text response from the model. Can be plain | |
text or structured JSON data. Learn more:</p> | |
<ul> | |
<li><a href="/docs/guides/text">Text inputs and outputs</a></li> | |
<li><a href="/docs/guides/structured-outputs">Structured Outputs</a></li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-create-text_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-tool_choice" data-anchor="responses-create-tool_choice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tool_choice</div><div class="param-type"><div class="docs-markdown-content"><p>string or object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>How the model should select which tool (or tools) to use when generating | |
a response. See the <code>tools</code> parameter to see how to specify which tools | |
the model can call.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-create-tool_choice_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-tools" data-anchor="responses-create-tools" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tools</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An array of tools the model may call while generating a response. You | |
can specify which tool to use by setting the <code>tool_choice</code> parameter.</p> | |
<p>The two categories of tools you can provide the model are:</p> | |
<ul> | |
<li><strong>Built-in tools</strong>: Tools that are provided by OpenAI that extend the | |
model's capabilities, like <a href="/docs/guides/tools-web-search">web search</a> | |
or <a href="/docs/guides/tools-file-search">file search</a>. Learn more about | |
<a href="/docs/guides/tools">built-in tools</a>.</li> | |
<li><strong>Function calls (custom tools)</strong>: Functions that are defined by you, | |
enabling the model to call your own code. Learn more about | |
<a href="/docs/guides/function-calling">function calling</a>.</li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-create-tools_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-top_p" data-anchor="responses-create-top_p" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">top_p</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 1</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An alternative to sampling with temperature, called nucleus sampling, | |
where the model considers the results of the tokens with top_p probability | |
mass. So 0.1 means only the tokens comprising the top 10% probability mass | |
are considered.</p> | |
<p>We generally recommend altering this or <code>temperature</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-truncation" data-anchor="responses-create-truncation" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">truncation</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to disabled</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The truncation strategy to use for the model response.</p> | |
<ul> | |
<li><code>auto</code>: If the context of this response and previous ones exceeds | |
the model's context window size, the model will truncate the | |
response to fit the context window by dropping input items in the | |
middle of the conversation.</li> | |
<li><code>disabled</code> (default): If a model response will exceed the context window | |
size for a model, the request will fail with a 400 error.</li> | |
</ul></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-create-user" data-anchor="responses-create-user" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">user</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. <a href="/docs/guides/safety-best-practices#end-user-ids">Learn more</a>.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>Returns a <a href="/docs/api-reference/responses/object">Response</a> object.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner section-right-inner-with-examples"><div class="mb-3 md:mb-0"><div class="flex"><div role="group" dir="ltr" class="Z6PRs" data-block="false" data-size="md" data-variant="pill" aria-label="Code example" tabindex="0" style="outline: none;"><div class="-X3Ew" data-variant="pill" style="width: 87px; transform: translateX(2px); transition: width var(--segmented-control-transition-duration) var(--cubic-enter), transform var(--segmented-control-transition-duration) var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="fC8KU" tabindex="-1" data-radix-collection-item="" style="--scale: 0.97;"><span class="JfMyo" aria-hidden="true">Text input</span><span class="ZDw29">Text input</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Image input</span><span class="ZDw29">Image input</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Web search</span><span class="ZDw29">Web search</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">File search</span><span class="ZDw29">File search</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Streaming</span><span class="ZDw29">Streaming</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Functions</span><span class="ZDw29">Functions</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Reasoning</span><span class="ZDw29">Reasoning</span></button></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:rl:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:rn:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>curl https://api.openai.com/v1/responses \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -d </span><span class="hljs-string">'{ | |
</span></span><span class="hljs-string"> "model": "gpt-4.1", | |
</span><span class="hljs-string"> "input": "Tell me a three sentence bedtime story about a unicorn." | |
</span><span class="hljs-string"> }'</span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-javascript" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span></code><span><span class="hljs-keyword">import</span><span> OpenAI </span><span class="hljs-keyword">from</span><span> </span><span class="hljs-string">"openai"</span><span>; | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> openai = </span><span class="hljs-keyword">new</span><span> OpenAI(); | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> response = </span><span class="hljs-keyword">await</span><span> openai.responses.create({ | |
</span></span><span><span> </span><span class="hljs-attr">model</span><span>: </span><span class="hljs-string">"gpt-4.1"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">input</span><span>: </span><span class="hljs-string">"Tell me a three sentence bedtime story about a unicorn."</span><span> | |
</span></span><span>}); | |
</span><span> | |
</span><span><span></span><span class="hljs-built_in">console</span><span>.log(response);</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span> | |
</span><span>client = OpenAI() | |
</span><span> | |
</span><span>response = client.responses.create( | |
</span><span><span> model=</span><span class="hljs-string">"gpt-4.1"</span><span>, | |
</span></span><span><span> </span><span class="hljs-built_in">input</span><span>=</span><span class="hljs-string">"Tell me a three sentence bedtime story about a unicorn."</span><span> | |
</span></span><span>) | |
</span><span> | |
</span><span><span></span><span class="hljs-built_in">print</span><span>(response)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span><span class="react-syntax-highlighter-line-number">46 | |
</span><span class="react-syntax-highlighter-line-number">47 | |
</span><span class="react-syntax-highlighter-line-number">48 | |
</span><span class="react-syntax-highlighter-line-number">49 | |
</span><span class="react-syntax-highlighter-line-number">50 | |
</span><span class="react-syntax-highlighter-line-number">51 | |
</span><span class="react-syntax-highlighter-line-number">52 | |
</span><span class="react-syntax-highlighter-line-number">53 | |
</span><span class="react-syntax-highlighter-line-number">54 | |
</span><span class="react-syntax-highlighter-line-number">55 | |
</span><span class="react-syntax-highlighter-line-number">56 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1741476542</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4.1-2025-04-14"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"parallel_tool_calls"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"summary"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens"</span><span>: </span><span class="hljs-number">36</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"cached_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"output_tokens"</span><span>: </span><span class="hljs-number">87</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">123</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/get" class="anchor-heading" data-name="responses/get"><div class="flex flex-row items-center gap-3">Get a model response</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-get">get</span> <span class="endpoint-path">https://api.openai.com/v1/responses/{response_id}</span></span></div><div class="endpoint-summary"><p>Retrieves a model response with the given ID.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="responses-get__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-get-response_id" data-anchor="responses-get-response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the response to retrieve.</p></div></div></div></div></div><div class="param-section"><h4>Query parameters</h4><div class="param-table" id="responses-get__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-get-include" data-anchor="responses-get-include" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">include</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Additional fields to include in the response. See the <code>include</code> | |
parameter for Response creation above for more information.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>The <a href="/docs/api-reference/responses/object">Response</a> object matching the | |
specified ID.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:ro:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:rq:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl https://api.openai.com/v1/responses/resp_123 \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-javascript" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">import</span><span> OpenAI </span><span class="hljs-keyword">from</span><span> </span><span class="hljs-string">"openai"</span><span>; | |
</span></span><span><span></span><span class="hljs-keyword">const</span><span> client = </span><span class="hljs-keyword">new</span><span> OpenAI(); | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> response = </span><span class="hljs-keyword">await</span><span> client.responses.retrieve(</span><span class="hljs-string">"resp_123"</span><span>); | |
</span></span><span><span></span><span class="hljs-built_in">console</span><span>.log(response);</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>response = client.responses.retrieve(</span><span class="hljs-string">"resp_123"</span><span>) | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(response)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span><span class="react-syntax-highlighter-line-number">46 | |
</span><span class="react-syntax-highlighter-line-number">47 | |
</span><span class="react-syntax-highlighter-line-number">48 | |
</span><span class="react-syntax-highlighter-line-number">49 | |
</span><span class="react-syntax-highlighter-line-number">50 | |
</span><span class="react-syntax-highlighter-line-number">51 | |
</span><span class="react-syntax-highlighter-line-number">52 | |
</span><span class="react-syntax-highlighter-line-number">53 | |
</span><span class="react-syntax-highlighter-line-number">54 | |
</span><span class="react-syntax-highlighter-line-number">55 | |
</span><span class="react-syntax-highlighter-line-number">56 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_67cb71b351908190a308f3859487620d06981a8637e6bc44"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1741386163</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"Silent circuits hum, \nThoughts emerge in data streams— \nDigital dawn breaks."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"parallel_tool_calls"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"summary"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens"</span><span>: </span><span class="hljs-number">32</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"cached_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"output_tokens"</span><span>: </span><span class="hljs-number">18</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">50</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/delete" class="anchor-heading" data-name="responses/delete"><div class="flex flex-row items-center gap-3">Delete a model response</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-delete">delete</span> <span class="endpoint-path">https://api.openai.com/v1/responses/{response_id}</span></span></div><div class="endpoint-summary"><p>Deletes a model response with the given ID.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="responses-delete__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-delete-response_id" data-anchor="responses-delete-response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the response to delete.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>A success message.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:rr:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:rt:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl -X DELETE https://api.openai.com/v1/responses/resp_123 \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-javascript" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">import</span><span> OpenAI </span><span class="hljs-keyword">from</span><span> </span><span class="hljs-string">"openai"</span><span>; | |
</span></span><span><span></span><span class="hljs-keyword">const</span><span> client = </span><span class="hljs-keyword">new</span><span> OpenAI(); | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> response = </span><span class="hljs-keyword">await</span><span> client.responses.del(</span><span class="hljs-string">"resp_123"</span><span>); | |
</span></span><span><span></span><span class="hljs-built_in">console</span><span>.log(response);</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>response = client.responses.</span><span class="hljs-keyword">del</span><span>(</span><span class="hljs-string">"resp_123"</span><span>) | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(response)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_6786a1bec27481909a17d673315b29f6"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"deleted"</span><span>: </span><span class="hljs-literal">true</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/input-items" class="anchor-heading" data-name="responses/input-items"><div class="flex flex-row items-center gap-3">List input items</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-get">get</span> <span class="endpoint-path">https://api.openai.com/v1/responses/{response_id}/input_items</span></span></div><div class="endpoint-summary"><p>Returns a list of input items for a given response.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="responses-input-items__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-response_id" data-anchor="responses-input-items-response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the response to retrieve input items for.</p></div></div></div></div></div><div class="param-section"><h4>Query parameters</h4><div class="param-table" id="responses-input-items__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-after" data-anchor="responses-input-items-after" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">after</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An item ID to list items after, used in pagination.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-before" data-anchor="responses-input-items-before" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">before</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An item ID to list items before, used in pagination.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-include" data-anchor="responses-input-items-include" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">include</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Additional fields to include in the response. See the <code>include</code> | |
parameter for Response creation above for more information.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-limit" data-anchor="responses-input-items-limit" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">limit</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 20</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A limit on the number of objects to be returned. Limit can range between | |
1 and 100, and the default is 20.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-input-items-order" data-anchor="responses-input-items-order" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">order</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The order to return the input items in. Default is <code>asc</code>.</p> | |
<ul> | |
<li><code>asc</code>: Return the input items in ascending order.</li> | |
<li><code>desc</code>: Return the input items in descending order.</li> | |
</ul></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>A list of input item objects.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:ru:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r10:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl https://api.openai.com/v1/responses/resp_abc123/input_items \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-javascript" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">import</span><span> OpenAI </span><span class="hljs-keyword">from</span><span> </span><span class="hljs-string">"openai"</span><span>; | |
</span></span><span><span></span><span class="hljs-keyword">const</span><span> client = </span><span class="hljs-keyword">new</span><span> OpenAI(); | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> response = </span><span class="hljs-keyword">await</span><span> client.responses.inputItems.list(</span><span class="hljs-string">"resp_123"</span><span>); | |
</span></span><span><span></span><span class="hljs-built_in">console</span><span>.log(response.data);</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>response = client.responses.input_items.</span><span class="hljs-built_in">list</span><span>(</span><span class="hljs-string">"resp_123"</span><span>) | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(response.data)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"Tell me a three sentence bedtime story about a unicorn."</span><span> | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/object" class="anchor-heading" data-name="responses/object"><div class="flex flex-row items-center gap-3">The response object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"></div><div class="param-table" id="responses/object__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-created_at" data-anchor="responses/object-created_at" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">created_at</div><div class="param-type"><div class="docs-markdown-content"><p>number</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Unix timestamp (in seconds) of when this Response was created.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-error" data-anchor="responses/object-error" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">error</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An error object returned when the model fails to generate a Response.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-error_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-id" data-anchor="responses/object-id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Unique identifier for this Response.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-incomplete_details" data-anchor="responses/object-incomplete_details" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">incomplete_details</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Details about why the response is incomplete.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-incomplete_details_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-instructions" data-anchor="responses/object-instructions" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">instructions</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Inserts a system (or developer) message as the first item in the model's context.</p> | |
<p>When using along with <code>previous_response_id</code>, the instructions from a previous | |
response will not be carried over to the next response. This makes it simple | |
to swap out system (or developer) messages in new responses.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-max_output_tokens" data-anchor="responses/object-max_output_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_output_tokens</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An upper bound for the number of tokens that can be generated for a response, including visible output tokens and <a href="/docs/guides/reasoning">reasoning tokens</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-metadata" data-anchor="responses/object-metadata" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">metadata</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Set of 16 key-value pairs that can be attached to an object. This can be | |
useful for storing additional information about the object in a structured | |
format, and querying for objects via API or the dashboard.</p> | |
<p>Keys are strings with a maximum length of 64 characters. Values are strings | |
with a maximum length of 512 characters.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-model" data-anchor="responses/object-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Model ID used to generate the response, like <code>gpt-4o</code> or <code>o3</code>. OpenAI | |
offers a wide range of models with different capabilities, performance | |
characteristics, and price points. Refer to the <a href="/docs/models">model guide</a> | |
to browse and compare available models.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-object" data-anchor="responses/object-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The object type of this resource - always set to <code>response</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-output" data-anchor="responses/object-output" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An array of content items generated by the model.</p> | |
<ul> | |
<li>The length and order of items in the <code>output</code> array is dependent | |
on the model's response.</li> | |
<li>Rather than accessing the first item in the <code>output</code> array and | |
assuming it's an <code>assistant</code> message with the content generated by | |
the model, you might consider using the <code>output_text</code> property where | |
supported in SDKs.</li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-output_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-output_text" data-anchor="responses/object-output_text" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_text</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="bg-blue-900 text-xs text-white px-1 py-0.5 rounded-sm ml-2">SDK Only</div></div><div class="param-desc"><div class="docs-markdown-content"><p>SDK-only convenience property that contains the aggregated text output | |
from all <code>output_text</code> items in the <code>output</code> array, if any are present. | |
Supported in the Python and JavaScript SDKs.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-parallel_tool_calls" data-anchor="responses/object-parallel_tool_calls" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">parallel_tool_calls</div><div class="param-type"><div class="docs-markdown-content"><p>boolean</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether to allow the model to run tool calls in parallel.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-previous_response_id" data-anchor="responses/object-previous_response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">previous_response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the previous response to the model. Use this to | |
create multi-turn conversations. Learn more about | |
<a href="/docs/guides/conversation-state">conversation state</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-reasoning" data-anchor="responses/object-reasoning" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">reasoning</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p><strong>o-series models only</strong></p> | |
<p>Configuration options for | |
<a href="https://platform.openai.com/docs/guides/reasoning" target="_blank" rel="noopener noreferrer">reasoning models</a>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-reasoning_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-service_tier" data-anchor="responses/object-service_tier" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">service_tier</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:</p> | |
<ul> | |
<li>If set to 'auto', and the Project is Scale tier enabled, the system | |
will utilize scale tier credits until they are exhausted.</li> | |
<li>If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'flex', the request will be processed with the Flex Processing service tier. <a href="/docs/guides/flex-processing">Learn more</a>.</li> | |
<li>When not set, the default behavior is 'auto'.</li> | |
</ul> | |
<p>When this parameter is set, the response body will include the <code>service_tier</code> utilized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-status" data-anchor="responses/object-status" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">status</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The status of the response generation. One of <code>completed</code>, <code>failed</code>, | |
<code>in_progress</code>, or <code>incomplete</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-temperature" data-anchor="responses/object-temperature" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">temperature</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | |
We generally recommend altering this or <code>top_p</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-text" data-anchor="responses/object-text" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">text</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration options for a text response from the model. Can be plain | |
text or structured JSON data. Learn more:</p> | |
<ul> | |
<li><a href="/docs/guides/text">Text inputs and outputs</a></li> | |
<li><a href="/docs/guides/structured-outputs">Structured Outputs</a></li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-text_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-tool_choice" data-anchor="responses/object-tool_choice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tool_choice</div><div class="param-type"><div class="docs-markdown-content"><p>string or object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>How the model should select which tool (or tools) to use when generating | |
a response. See the <code>tools</code> parameter to see how to specify which tools | |
the model can call.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-tool_choice_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-tools" data-anchor="responses/object-tools" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tools</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An array of tools the model may call while generating a response. You | |
can specify which tool to use by setting the <code>tool_choice</code> parameter.</p> | |
<p>The two categories of tools you can provide the model are:</p> | |
<ul> | |
<li><strong>Built-in tools</strong>: Tools that are provided by OpenAI that extend the | |
model's capabilities, like <a href="/docs/guides/tools-web-search">web search</a> | |
or <a href="/docs/guides/tools-file-search">file search</a>. Learn more about | |
<a href="/docs/guides/tools">built-in tools</a>.</li> | |
<li><strong>Function calls (custom tools)</strong>: Functions that are defined by you, | |
enabling the model to call your own code. Learn more about | |
<a href="/docs/guides/function-calling">function calling</a>.</li> | |
</ul></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-tools_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-top_p" data-anchor="responses/object-top_p" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">top_p</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An alternative to sampling with temperature, called nucleus sampling, | |
where the model considers the results of the tokens with top_p probability | |
mass. So 0.1 means only the tokens comprising the top 10% probability mass | |
are considered.</p> | |
<p>We generally recommend altering this or <code>temperature</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-truncation" data-anchor="responses/object-truncation" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">truncation</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The truncation strategy to use for the model response.</p> | |
<ul> | |
<li><code>auto</code>: If the context of this response and previous ones exceeds | |
the model's context window size, the model will truncate the | |
response to fit the context window by dropping input items in the | |
middle of the conversation.</li> | |
<li><code>disabled</code> (default): If a model response will exceed the context window | |
size for a model, the request will fail with a 400 error.</li> | |
</ul></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-usage" data-anchor="responses/object-usage" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">usage</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Represents token usage details including input tokens, output tokens, | |
a breakdown of output tokens, and the total tokens used.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/object-usage_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/object-user" data-anchor="responses/object-user" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">user</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. <a href="/docs/guides/safety-best-practices#end-user-ids">Learn more</a>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The response object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span><span class="react-syntax-highlighter-line-number">46 | |
</span><span class="react-syntax-highlighter-line-number">47 | |
</span><span class="react-syntax-highlighter-line-number">48 | |
</span><span class="react-syntax-highlighter-line-number">49 | |
</span><span class="react-syntax-highlighter-line-number">50 | |
</span><span class="react-syntax-highlighter-line-number">51 | |
</span><span class="react-syntax-highlighter-line-number">52 | |
</span><span class="react-syntax-highlighter-line-number">53 | |
</span><span class="react-syntax-highlighter-line-number">54 | |
</span><span class="react-syntax-highlighter-line-number">55 | |
</span><span class="react-syntax-highlighter-line-number">56 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1741476777</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"parallel_tool_calls"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"summary"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens"</span><span>: </span><span class="hljs-number">328</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"cached_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"output_tokens"</span><span>: </span><span class="hljs-number">52</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">380</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses/list" class="anchor-heading" data-name="responses/list"><div class="flex flex-row items-center gap-3">The input item list</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>A list of Response items.</p></div><div class="param-table" id="responses/list__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/list-data" data-anchor="responses/list-data" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">data</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of items used to generate this response.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses/list-data_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/list-first_id" data-anchor="responses/list-first_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">first_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the first item in the list.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/list-has_more" data-anchor="responses/list-has_more" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">has_more</div><div class="param-type"><div class="docs-markdown-content"><p>boolean</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether there are more items available.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/list-last_id" data-anchor="responses/list-last_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">last_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the last item in the list.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses/list-object" data-anchor="responses/list-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of object returned, must be <code>list</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The input item list</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"Tell me a three sentence bedtime story about a unicorn."</span><span> | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="responses-streaming" class="anchor-heading" data-name="responses-streaming"><div class="flex flex-row items-center gap-3">Streaming</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>When you <a href="/docs/api-reference/responses/create">create a Response</a> with | |
<code>stream</code> set to <code>true</code>, the server will emit server-sent events to the | |
client as the Response is generated. This section contains the events that | |
are emitted by the server.</p> | |
<p><a href="/docs/guides/streaming-responses?api-mode=responses">Learn more about streaming responses</a>.</p></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response" class="anchor-heading" data-name="responses-streaming/response"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/created" class="anchor-heading" data-name="responses-streaming/response/created"><div class="flex flex-row items-center gap-3">response.created</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>An event that is emitted when a response is created.</p></div><div class="param-table" id="responses-streaming/response/created__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/created-response" data-anchor="responses-streaming/response/created-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The response that was created.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/created-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/created-type" data-anchor="responses-streaming/response/created-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.created</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.created</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.created"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1741487325</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"parallel_tool_calls"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"summary"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/in_progress" class="anchor-heading" data-name="responses-streaming/response/in_progress"><div class="flex flex-row items-center gap-3">response.in_progress</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when the response is in progress.</p></div><div class="param-table" id="responses-streaming/response/in_progress__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/in_progress-response" data-anchor="responses-streaming/response/in_progress-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The response that is in progress.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/in_progress-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/in_progress-type" data-anchor="responses-streaming/response/in_progress-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.in_progress</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.in_progress</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1741487325</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"parallel_tool_calls"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"summary"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/completed" class="anchor-heading" data-name="responses-streaming/response/completed"><div class="flex flex-row items-center gap-3">response.completed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when the model response is complete.</p></div><div class="param-table" id="responses-streaming/response/completed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/completed-response" data-anchor="responses-streaming/response/completed-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Properties of the completed response.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/completed-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/completed-type" data-anchor="responses-streaming/response/completed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.completed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.completed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span><span class="react-syntax-highlighter-line-number">46 | |
</span><span class="react-syntax-highlighter-line-number">47 | |
</span><span class="react-syntax-highlighter-line-number">48 | |
</span><span class="react-syntax-highlighter-line-number">49 | |
</span><span class="react-syntax-highlighter-line-number">50 | |
</span><span class="react-syntax-highlighter-line-number">51 | |
</span><span class="react-syntax-highlighter-line-number">52 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1740855869</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-mini-2024-07-18"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">false</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"input_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/failed" class="anchor-heading" data-name="responses-streaming/response/failed"><div class="flex flex-row items-center gap-3">response.failed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>An event that is emitted when a response fails.</p></div><div class="param-table" id="responses-streaming/response/failed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/failed-response" data-anchor="responses-streaming/response/failed-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The response that failed.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/failed-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/failed-type" data-anchor="responses-streaming/response/failed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.failed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.failed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.failed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1740855869</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"failed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"code"</span><span>: </span><span class="hljs-string">"server_error"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: </span><span class="hljs-string">"The model failed to generate a response."</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-mini-2024-07-18"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">false</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/incomplete" class="anchor-heading" data-name="responses-streaming/response/incomplete"><div class="flex flex-row items-center gap-3">response.incomplete</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>An event that is emitted when a response finishes as incomplete.</p></div><div class="param-table" id="responses-streaming/response/incomplete__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/incomplete-response" data-anchor="responses-streaming/response/incomplete-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The response that was incomplete.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/incomplete-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/incomplete-type" data-anchor="responses-streaming/response/incomplete-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.incomplete</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.incomplete</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.incomplete"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"resp_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"response"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created_at"</span><span>: </span><span class="hljs-number">1740855869</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"incomplete"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"incomplete_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reason"</span><span>: </span><span class="hljs-string">"max_tokens"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-mini-2024-07-18"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"previous_response_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_effort"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"store"</span><span>: </span><span class="hljs-literal">false</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"format"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"text"</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"truncation"</span><span>: </span><span class="hljs-string">"disabled"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {} | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_item" class="anchor-heading" data-name="responses-streaming/response/output_item"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_item/added" class="anchor-heading" data-name="responses-streaming/response/output_item/added"><div class="flex flex-row items-center gap-3">response.output_item.added</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a new output item is added.</p></div><div class="param-table" id="responses-streaming/response/output_item/added__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/added-item" data-anchor="responses-streaming/response/output_item/added-item" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The output item that was added.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/output_item/added-item_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/added-output_index" data-anchor="responses-streaming/response/output_item/added-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that was added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/added-type" data-anchor="responses-streaming/response/output_item/added-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.output_item.added</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.output_item.added</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.output_item.added"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [] | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_item/done" class="anchor-heading" data-name="responses-streaming/response/output_item/done"><div class="flex flex-row items-center gap-3">response.output_item.done</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when an output item is marked done.</p></div><div class="param-table" id="responses-streaming/response/output_item/done__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/done-item" data-anchor="responses-streaming/response/output_item/done-item" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The output item that was marked done.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/output_item/done-item_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/done-output_index" data-anchor="responses-streaming/response/output_item/done-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that was marked done.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_item/done-type" data-anchor="responses-streaming/response/output_item/done-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.output_item.done</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.output_item.done</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.output_item.done"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/content_part" class="anchor-heading" data-name="responses-streaming/response/content_part"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/content_part/added" class="anchor-heading" data-name="responses-streaming/response/content_part/added"><div class="flex flex-row items-center gap-3">response.content_part.added</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a new content part is added.</p></div><div class="param-table" id="responses-streaming/response/content_part/added__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/added-content_index" data-anchor="responses-streaming/response/content_part/added-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that was added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/added-item_id" data-anchor="responses-streaming/response/content_part/added-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the content part was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/added-output_index" data-anchor="responses-streaming/response/content_part/added-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the content part was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/added-part" data-anchor="responses-streaming/response/content_part/added-part" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">part</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The content part that was added.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/content_part/added-part_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/added-type" data-anchor="responses-streaming/response/content_part/added-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.content_part.added</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.content_part.added</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.content_part.added"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"part"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">""</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/content_part/done" class="anchor-heading" data-name="responses-streaming/response/content_part/done"><div class="flex flex-row items-center gap-3">response.content_part.done</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a content part is done.</p></div><div class="param-table" id="responses-streaming/response/content_part/done__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/done-content_index" data-anchor="responses-streaming/response/content_part/done-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that is done.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/done-item_id" data-anchor="responses-streaming/response/content_part/done-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the content part was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/done-output_index" data-anchor="responses-streaming/response/content_part/done-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the content part was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/done-part" data-anchor="responses-streaming/response/content_part/done-part" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">part</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The content part that is done.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/content_part/done-part_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/content_part/done-type" data-anchor="responses-streaming/response/content_part/done-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.content_part.done</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.content_part.done</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.content_part.done"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"part"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"output_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_text" class="anchor-heading" data-name="responses-streaming/response/output_text"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_text/delta" class="anchor-heading" data-name="responses-streaming/response/output_text/delta"><div class="flex flex-row items-center gap-3">response.output_text.delta</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when there is an additional text delta.</p></div><div class="param-table" id="responses-streaming/response/output_text/delta__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/delta-content_index" data-anchor="responses-streaming/response/output_text/delta-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that the text delta was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/delta-delta" data-anchor="responses-streaming/response/output_text/delta-delta" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">delta</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The text delta that was added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/delta-item_id" data-anchor="responses-streaming/response/output_text/delta-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the text delta was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/delta-output_index" data-anchor="responses-streaming/response/output_text/delta-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the text delta was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/delta-type" data-anchor="responses-streaming/response/output_text/delta-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.output_text.delta</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.output_text.delta</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.output_text.delta"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"delta"</span><span>: </span><span class="hljs-string">"In"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_text/annotation" class="anchor-heading" data-name="responses-streaming/response/output_text/annotation"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_text/annotation/added" class="anchor-heading" data-name="responses-streaming/response/output_text/annotation/added"><div class="flex flex-row items-center gap-3">response.output_text.annotation.added</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a text annotation is added.</p></div><div class="param-table" id="responses-streaming/response/output_text/annotation/added__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-annotation" data-anchor="responses-streaming/response/output_text/annotation/added-annotation" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">annotation</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="responses-streaming/response/output_text/annotation/added-annotation_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-annotation_index" data-anchor="responses-streaming/response/output_text/annotation/added-annotation_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">annotation_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the annotation that was added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-content_index" data-anchor="responses-streaming/response/output_text/annotation/added-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that the text annotation was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-item_id" data-anchor="responses-streaming/response/output_text/annotation/added-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the text annotation was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-output_index" data-anchor="responses-streaming/response/output_text/annotation/added-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the text annotation was added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/annotation/added-type" data-anchor="responses-streaming/response/output_text/annotation/added-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.output_text.annotation.added</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.output_text.annotation.added</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.output_text.annotation.added"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotation_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotation"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"file_citation"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">390</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"file_id"</span><span>: </span><span class="hljs-string">"file-4wDz5b167pAf72nx1h9eiN"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"filename"</span><span>: </span><span class="hljs-string">"dragons.pdf"</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/output_text/done" class="anchor-heading" data-name="responses-streaming/response/output_text/done"><div class="flex flex-row items-center gap-3">response.output_text.done</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when text content is finalized.</p></div><div class="param-table" id="responses-streaming/response/output_text/done__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/done-content_index" data-anchor="responses-streaming/response/output_text/done-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that the text content is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/done-item_id" data-anchor="responses-streaming/response/output_text/done-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the text content is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/done-output_index" data-anchor="responses-streaming/response/output_text/done-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the text content is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/done-text" data-anchor="responses-streaming/response/output_text/done-text" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">text</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The text content that is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/output_text/done-type" data-anchor="responses-streaming/response/output_text/done-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.output_text.done</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.output_text.done</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.output_text.done"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic."</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/refusal" class="anchor-heading" data-name="responses-streaming/response/refusal"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/refusal/delta" class="anchor-heading" data-name="responses-streaming/response/refusal/delta"><div class="flex flex-row items-center gap-3">response.refusal.delta</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when there is a partial refusal text.</p></div><div class="param-table" id="responses-streaming/response/refusal/delta__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/delta-content_index" data-anchor="responses-streaming/response/refusal/delta-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that the refusal text is added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/delta-delta" data-anchor="responses-streaming/response/refusal/delta-delta" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">delta</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The refusal text that is added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/delta-item_id" data-anchor="responses-streaming/response/refusal/delta-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the refusal text is added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/delta-output_index" data-anchor="responses-streaming/response/refusal/delta-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the refusal text is added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/delta-type" data-anchor="responses-streaming/response/refusal/delta-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.refusal.delta</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.refusal.delta</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.refusal.delta"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"delta"</span><span>: </span><span class="hljs-string">"refusal text so far"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/refusal/done" class="anchor-heading" data-name="responses-streaming/response/refusal/done"><div class="flex flex-row items-center gap-3">response.refusal.done</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when refusal text is finalized.</p></div><div class="param-table" id="responses-streaming/response/refusal/done__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/done-content_index" data-anchor="responses-streaming/response/refusal/done-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that the refusal text is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/done-item_id" data-anchor="responses-streaming/response/refusal/done-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the refusal text is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/done-output_index" data-anchor="responses-streaming/response/refusal/done-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the refusal text is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/done-refusal" data-anchor="responses-streaming/response/refusal/done-refusal" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">refusal</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The refusal text that is finalized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/refusal/done-type" data-anchor="responses-streaming/response/refusal/done-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.refusal.done</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.refusal.done</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.refusal.done"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"item-abc"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">2</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"refusal"</span><span>: </span><span class="hljs-string">"final refusal text"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/function_call_arguments" class="anchor-heading" data-name="responses-streaming/response/function_call_arguments"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/function_call_arguments/delta" class="anchor-heading" data-name="responses-streaming/response/function_call_arguments/delta"><div class="flex flex-row items-center gap-3">response.function_call_arguments.delta</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when there is a partial function-call arguments delta.</p></div><div class="param-table" id="responses-streaming/response/function_call_arguments/delta__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/delta-delta" data-anchor="responses-streaming/response/function_call_arguments/delta-delta" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">delta</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The function-call arguments delta that is added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/delta-item_id" data-anchor="responses-streaming/response/function_call_arguments/delta-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the function-call arguments delta is added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/delta-output_index" data-anchor="responses-streaming/response/function_call_arguments/delta-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the function-call arguments delta is added to.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/delta-type" data-anchor="responses-streaming/response/function_call_arguments/delta-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.function_call_arguments.delta</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.function_call_arguments.delta</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.function_call_arguments.delta"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"item-abc"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"delta"</span><span>: </span><span class="hljs-string">"{ \"arg\":"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/function_call_arguments/done" class="anchor-heading" data-name="responses-streaming/response/function_call_arguments/done"><div class="flex flex-row items-center gap-3">response.function_call_arguments.done</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when function-call arguments are finalized.</p></div><div class="param-table" id="responses-streaming/response/function_call_arguments/done__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/done-arguments" data-anchor="responses-streaming/response/function_call_arguments/done-arguments" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">arguments</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The function-call arguments.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/done-item_id" data-anchor="responses-streaming/response/function_call_arguments/done-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the item.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/done-output_index" data-anchor="responses-streaming/response/function_call_arguments/done-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/function_call_arguments/done-type" data-anchor="responses-streaming/response/function_call_arguments/done-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.function_call_arguments.done</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.function_call_arguments.done"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"item-abc"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">1</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"arguments"</span><span>: </span><span class="hljs-string">"{ \"arg\": 123 }"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/file_search_call" class="anchor-heading" data-name="responses-streaming/response/file_search_call"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/file_search_call/in_progress" class="anchor-heading" data-name="responses-streaming/response/file_search_call/in_progress"><div class="flex flex-row items-center gap-3">response.file_search_call.in_progress</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a file search call is initiated.</p></div><div class="param-table" id="responses-streaming/response/file_search_call/in_progress__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/in_progress-item_id" data-anchor="responses-streaming/response/file_search_call/in_progress-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the file search call is initiated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/in_progress-output_index" data-anchor="responses-streaming/response/file_search_call/in_progress-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the file search call is initiated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/in_progress-type" data-anchor="responses-streaming/response/file_search_call/in_progress-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.file_search_call.in_progress</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.file_search_call.in_progress</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.file_search_call.in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"fs_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/file_search_call/searching" class="anchor-heading" data-name="responses-streaming/response/file_search_call/searching"><div class="flex flex-row items-center gap-3">response.file_search_call.searching</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a file search is currently searching.</p></div><div class="param-table" id="responses-streaming/response/file_search_call/searching__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/searching-item_id" data-anchor="responses-streaming/response/file_search_call/searching-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the file search call is initiated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/searching-output_index" data-anchor="responses-streaming/response/file_search_call/searching-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the file search call is searching.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/searching-type" data-anchor="responses-streaming/response/file_search_call/searching-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.file_search_call.searching</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.file_search_call.searching</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.file_search_call.searching"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"fs_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/file_search_call/completed" class="anchor-heading" data-name="responses-streaming/response/file_search_call/completed"><div class="flex flex-row items-center gap-3">response.file_search_call.completed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a file search call is completed (results found).</p></div><div class="param-table" id="responses-streaming/response/file_search_call/completed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/completed-item_id" data-anchor="responses-streaming/response/file_search_call/completed-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the output item that the file search call is initiated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/completed-output_index" data-anchor="responses-streaming/response/file_search_call/completed-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the file search call is initiated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/file_search_call/completed-type" data-anchor="responses-streaming/response/file_search_call/completed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.file_search_call.completed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.file_search_call.completed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.file_search_call.completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"fs_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/web_search_call" class="anchor-heading" data-name="responses-streaming/response/web_search_call"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/web_search_call/in_progress" class="anchor-heading" data-name="responses-streaming/response/web_search_call/in_progress"><div class="flex flex-row items-center gap-3">response.web_search_call.in_progress</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a web search call is initiated.</p></div><div class="param-table" id="responses-streaming/response/web_search_call/in_progress__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/in_progress-item_id" data-anchor="responses-streaming/response/web_search_call/in_progress-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Unique ID for the output item associated with the web search call.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/in_progress-output_index" data-anchor="responses-streaming/response/web_search_call/in_progress-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the web search call is associated with.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/in_progress-type" data-anchor="responses-streaming/response/web_search_call/in_progress-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.web_search_call.in_progress</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.web_search_call.in_progress</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.web_search_call.in_progress"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"ws_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/web_search_call/searching" class="anchor-heading" data-name="responses-streaming/response/web_search_call/searching"><div class="flex flex-row items-center gap-3">response.web_search_call.searching</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a web search call is executing.</p></div><div class="param-table" id="responses-streaming/response/web_search_call/searching__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/searching-item_id" data-anchor="responses-streaming/response/web_search_call/searching-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Unique ID for the output item associated with the web search call.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/searching-output_index" data-anchor="responses-streaming/response/web_search_call/searching-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the web search call is associated with.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/searching-type" data-anchor="responses-streaming/response/web_search_call/searching-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.web_search_call.searching</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.web_search_call.searching</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.web_search_call.searching"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"ws_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/response/web_search_call/completed" class="anchor-heading" data-name="responses-streaming/response/web_search_call/completed"><div class="flex flex-row items-center gap-3">response.web_search_call.completed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when a web search call is completed.</p></div><div class="param-table" id="responses-streaming/response/web_search_call/completed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/completed-item_id" data-anchor="responses-streaming/response/web_search_call/completed-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Unique ID for the output item associated with the web search call.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/completed-output_index" data-anchor="responses-streaming/response/web_search_call/completed-output_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the output item that the web search call is associated with.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/response/web_search_call/completed-type" data-anchor="responses-streaming/response/web_search_call/completed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>response.web_search_call.completed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.web_search_call.completed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.web_search_call.completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"ws_123"</span><span>, | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="responses-streaming/error" class="anchor-heading" data-name="responses-streaming/error"><div class="flex flex-row items-center gap-3">error</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Emitted when an error occurs.</p></div><div class="param-table" id="responses-streaming/error__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/error-code" data-anchor="responses-streaming/error-code" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">code</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The error code.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/error-message" data-anchor="responses-streaming/error-message" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">message</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The error message.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/error-param" data-anchor="responses-streaming/error-param" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">param</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The error parameter.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#responses-streaming/error-type" data-anchor="responses-streaming/error-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of the event. Always <code>error</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT error</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"error"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"code"</span><span>: </span><span class="hljs-string">"ERR_SOMETHING"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: </span><span class="hljs-string">"Something went wrong"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"param"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="chat" class="anchor-heading" data-name="chat"><div class="flex flex-row items-center gap-3">Chat Completions</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>The Chat Completions API endpoint will generate a model response from a | |
list of messages comprising a conversation.</p> | |
<p>Related guides:</p> | |
<ul> | |
<li><a href="/docs/quickstart?api-mode=chat">Quickstart</a></li> | |
<li><a href="/docs/guides/text?api-mode=chat">Text inputs and outputs</a></li> | |
<li><a href="/docs/guides/images?api-mode=chat">Image inputs</a></li> | |
<li><a href="/docs/guides/audio?api-mode=chat">Audio inputs and outputs</a></li> | |
<li><a href="/docs/guides/structured-outputs?api-mode=chat">Structured Outputs</a></li> | |
<li><a href="/docs/guides/function-calling?api-mode=chat">Function calling</a></li> | |
<li><a href="/docs/guides/conversation-state?api-mode=chat">Conversation state</a></li> | |
</ul> | |
<p><strong>Starting a new project?</strong> We recommend trying <a href="/docs/api-reference/responses">Responses</a> | |
to take advantage of the latest OpenAI platform features. Compare | |
<a href="/docs/guides/responses-vs-chat-completions?api-mode=responses">Chat Completions with Responses</a>.</p></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/create" class="anchor-heading" data-name="chat/create"><div class="flex flex-row items-center gap-3">Create chat completion</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-post">post</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions</span></span></div><div class="endpoint-summary"><p><strong>Starting a new project?</strong> We recommend trying <a href="/docs/api-reference/responses">Responses</a> | |
to take advantage of the latest OpenAI platform features. Compare | |
<a href="/docs/guides/responses-vs-chat-completions?api-mode=responses">Chat Completions with Responses</a>.</p> | |
<hr> | |
<p>Creates a model response for the given chat conversation. Learn more in the | |
<a href="/docs/guides/text-generation">text generation</a>, <a href="/docs/guides/vision">vision</a>, | |
and <a href="/docs/guides/audio">audio</a> guides.</p> | |
<p>Parameter support can differ depending on the model used to generate the | |
response, particularly for newer reasoning models. Parameters that are only | |
supported for reasoning models are noted below. For the current state of | |
unsupported parameters in reasoning models, | |
<a href="/docs/guides/reasoning">refer to the reasoning guide</a>.</p></div><div class="param-section"><h4>Request body</h4><div class="param-table" id="chat-create__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-messages" data-anchor="chat-create-messages" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">messages</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of messages comprising the conversation so far. Depending on the | |
<a href="/docs/models">model</a> you use, different message types (modalities) are | |
supported, like <a href="/docs/guides/text-generation">text</a>, | |
<a href="/docs/guides/vision">images</a>, and <a href="/docs/guides/audio">audio</a>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-messages_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-model" data-anchor="chat-create-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Model ID used to generate the response, like <code>gpt-4o</code> or <code>o3</code>. OpenAI | |
offers a wide range of models with different capabilities, performance | |
characteristics, and price points. Refer to the <a href="/docs/models">model guide</a> | |
to browse and compare available models.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-audio" data-anchor="chat-create-audio" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">audio</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Parameters for audio output. Required when audio output is requested with | |
<code>modalities: ["audio"]</code>. <a href="/docs/guides/audio">Learn more</a>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-audio_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-frequency_penalty" data-anchor="chat-create-frequency_penalty" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">frequency_penalty</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 0</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Number between -2.0 and 2.0. Positive values penalize new tokens based on | |
their existing frequency in the text so far, decreasing the model's | |
likelihood to repeat the same line verbatim.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-function_call" data-anchor="chat-create-function_call" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">function_call</div><div class="param-depr">Deprecated</div><div class="param-type"><div class="docs-markdown-content"><p>string or object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Deprecated in favor of <code>tool_choice</code>.</p> | |
<p>Controls which (if any) function is called by the model.</p> | |
<p><code>none</code> means the model will not call a function and instead generates a | |
message.</p> | |
<p><code>auto</code> means the model can pick between generating a message or calling a | |
function.</p> | |
<p>Specifying a particular function via <code>{"name": "my_function"}</code> forces the | |
model to call that function.</p> | |
<p><code>none</code> is the default when no functions are present. <code>auto</code> is the default | |
if functions are present.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-function_call_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-functions" data-anchor="chat-create-functions" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">functions</div><div class="param-depr">Deprecated</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Deprecated in favor of <code>tools</code>.</p> | |
<p>A list of functions the model may generate JSON inputs for.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-functions_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-logit_bias" data-anchor="chat-create-logit_bias" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">logit_bias</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to null</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Modify the likelihood of specified tokens appearing in the completion.</p> | |
<p>Accepts a JSON object that maps tokens (specified by their token ID in the | |
tokenizer) to an associated bias value from -100 to 100. Mathematically, | |
the bias is added to the logits generated by the model prior to sampling. | |
The exact effect will vary per model, but values between -1 and 1 should | |
decrease or increase likelihood of selection; values like -100 or 100 | |
should result in a ban or exclusive selection of the relevant token.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-logprobs" data-anchor="chat-create-logprobs" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">logprobs</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to false</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether to return log probabilities of the output tokens or not. If true, | |
returns the log probabilities of each output token returned in the | |
<code>content</code> of <code>message</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-max_completion_tokens" data-anchor="chat-create-max_completion_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_completion_tokens</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and <a href="/docs/guides/reasoning">reasoning tokens</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-max_tokens" data-anchor="chat-create-max_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_tokens</div><div class="param-depr">Deprecated</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The maximum number of <a href="/tokenizer">tokens</a> that can be generated in the | |
chat completion. This value can be used to control | |
<a href="https://openai.com/api/pricing/" target="_blank" rel="noopener noreferrer">costs</a> for text generated via API.</p> | |
<p>This value is now deprecated in favor of <code>max_completion_tokens</code>, and is | |
not compatible with <a href="/docs/guides/reasoning">o-series models</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-metadata" data-anchor="chat-create-metadata" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">metadata</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Set of 16 key-value pairs that can be attached to an object. This can be | |
useful for storing additional information about the object in a structured | |
format, and querying for objects via API or the dashboard.</p> | |
<p>Keys are strings with a maximum length of 64 characters. Values are strings | |
with a maximum length of 512 characters.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-modalities" data-anchor="chat-create-modalities" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">modalities</div><div class="param-type"><div class="docs-markdown-content"><p>array or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Output types that you would like the model to generate. | |
Most models are capable of generating text, which is the default:</p> | |
<p><code>["text"]</code></p> | |
<p>The <code>gpt-4o-audio-preview</code> model can also be used to | |
<a href="/docs/guides/audio">generate audio</a>. To request that this model generate | |
both text and audio responses, you can use:</p> | |
<p><code>["text", "audio"]</code></p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-n" data-anchor="chat-create-n" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">n</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 1</div></div><div class="param-desc"><div class="docs-markdown-content"><p>How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep <code>n</code> as <code>1</code> to minimize costs.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-parallel_tool_calls" data-anchor="chat-create-parallel_tool_calls" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">parallel_tool_calls</div><div class="param-type"><div class="docs-markdown-content"><p>boolean</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to true</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether to enable <a href="/docs/guides/function-calling#configuring-parallel-function-calling">parallel function calling</a> during tool use.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-prediction" data-anchor="chat-create-prediction" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">prediction</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for a <a href="/docs/guides/predicted-outputs">Predicted Output</a>, | |
which can greatly improve response times when large parts of the model | |
response are known ahead of time. This is most common when you are | |
regenerating a file with only minor changes to most of the content.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-prediction_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-presence_penalty" data-anchor="chat-create-presence_penalty" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">presence_penalty</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 0</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Number between -2.0 and 2.0. Positive values penalize new tokens based on | |
whether they appear in the text so far, increasing the model's likelihood | |
to talk about new topics.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-reasoning_effort" data-anchor="chat-create-reasoning_effort" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">reasoning_effort</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to medium</div></div><div class="param-desc"><div class="docs-markdown-content"><p><strong>o-series models only</strong></p> | |
<p>Constrains effort on reasoning for | |
<a href="https://platform.openai.com/docs/guides/reasoning" target="_blank" rel="noopener noreferrer">reasoning models</a>. | |
Currently supported values are <code>low</code>, <code>medium</code>, and <code>high</code>. Reducing | |
reasoning effort can result in faster responses and fewer tokens used | |
on reasoning in a response.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-response_format" data-anchor="chat-create-response_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response_format</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An object specifying the format that the model must output.</p> | |
<p>Setting to <code>{ "type": "json_schema", "json_schema": {...} }</code> enables | |
Structured Outputs which ensures the model will match your supplied JSON | |
schema. Learn more in the <a href="/docs/guides/structured-outputs">Structured Outputs | |
guide</a>.</p> | |
<p>Setting to <code>{ "type": "json_object" }</code> enables the older JSON mode, which | |
ensures the message the model generates is valid JSON. Using <code>json_schema</code> | |
is preferred for models that support it.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-response_format_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-seed" data-anchor="chat-create-seed" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">seed</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>This feature is in Beta. | |
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same <code>seed</code> and parameters should return the same result. | |
Determinism is not guaranteed, and you should refer to the <code>system_fingerprint</code> response parameter to monitor changes in the backend.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-service_tier" data-anchor="chat-create-service_tier" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">service_tier</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to auto</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:</p> | |
<ul> | |
<li>If set to 'auto', and the Project is Scale tier enabled, the system | |
will utilize scale tier credits until they are exhausted.</li> | |
<li>If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'flex', the request will be processed with the Flex Processing service tier. <a href="/docs/guides/flex-processing">Learn more</a>.</li> | |
<li>When not set, the default behavior is 'auto'.</li> | |
</ul> | |
<p>When this parameter is set, the response body will include the <code>service_tier</code> utilized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-stop" data-anchor="chat-create-stop" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">stop</div><div class="param-type"><div class="docs-markdown-content"><p>string / array / null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to null</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Not supported with latest reasoning models <code>o3</code> and <code>o4-mini</code>.</p> | |
<p>Up to 4 sequences where the API will stop generating further tokens. The | |
returned text will not contain the stop sequence.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-store" data-anchor="chat-create-store" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">store</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to false</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Whether or not to store the output of this chat completion request for | |
use in our <a href="/docs/guides/distillation">model distillation</a> or | |
<a href="/docs/guides/evals">evals</a> products.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-stream" data-anchor="chat-create-stream" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">stream</div><div class="param-type"><div class="docs-markdown-content"><p>boolean or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to false</div></div><div class="param-desc"><div class="docs-markdown-content"><p>If set to true, the model response data will be streamed to the client | |
as it is generated using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format" target="_blank" rel="noopener noreferrer">server-sent events</a>. | |
See the <a href="/docs/api-reference/chat/streaming">Streaming section below</a> | |
for more information, along with the <a href="/docs/guides/streaming-responses">streaming responses</a> | |
guide for more information on how to handle the streaming events.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-stream_options" data-anchor="chat-create-stream_options" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">stream_options</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to null</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Options for streaming response. Only set this when you set <code>stream: true</code>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-stream_options_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-temperature" data-anchor="chat-create-temperature" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">temperature</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 1</div></div><div class="param-desc"><div class="docs-markdown-content"><p>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | |
We generally recommend altering this or <code>top_p</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-tool_choice" data-anchor="chat-create-tool_choice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tool_choice</div><div class="param-type"><div class="docs-markdown-content"><p>string or object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Controls which (if any) tool is called by the model. | |
<code>none</code> means the model will not call any tool and instead generates a message. | |
<code>auto</code> means the model can pick between generating a message or calling one or more tools. | |
<code>required</code> means the model must call one or more tools. | |
Specifying a particular tool via <code>{"type": "function", "function": {"name": "my_function"}}</code> forces the model to call that tool.</p> | |
<p><code>none</code> is the default when no tools are present. <code>auto</code> is the default if tools are present.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-tool_choice_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show possible types</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-tools" data-anchor="chat-create-tools" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tools</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-tools_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-top_logprobs" data-anchor="chat-create-top_logprobs" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">top_logprobs</div><div class="param-type"><div class="docs-markdown-content"><p>integer or null</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An integer between 0 and 20 specifying the number of most likely tokens to | |
return at each token position, each with an associated log probability. | |
<code>logprobs</code> must be set to <code>true</code> if this parameter is used.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-top_p" data-anchor="chat-create-top_p" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">top_p</div><div class="param-type"><div class="docs-markdown-content"><p>number or null</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 1</div></div><div class="param-desc"><div class="docs-markdown-content"><p>An alternative to sampling with temperature, called nucleus sampling, | |
where the model considers the results of the tokens with top_p probability | |
mass. So 0.1 means only the tokens comprising the top 10% probability mass | |
are considered.</p> | |
<p>We generally recommend altering this or <code>temperature</code> but not both.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-user" data-anchor="chat-create-user" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">user</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. <a href="/docs/guides/safety-best-practices#end-user-ids">Learn more</a>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-create-web_search_options" data-anchor="chat-create-web_search_options" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">web_search_options</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>This tool searches the web for relevant results to use in a response. | |
Learn more about the <a href="/docs/guides/tools-web-search?api-mode=chat">web search tool</a>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-create-web_search_options_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>Returns a <a href="/docs/api-reference/chat/object">chat completion</a> object, or a streamed sequence of <a href="/docs/api-reference/chat/streaming">chat completion chunk</a> objects if the request is streamed.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner section-right-inner-with-examples"><div class="mb-3 md:mb-0"><div class="flex"><div role="group" dir="ltr" class="Z6PRs" data-block="false" data-size="md" data-variant="pill" aria-label="Code example" tabindex="0" style="outline: none;"><div class="-X3Ew" data-variant="pill" style="width: 71px; transform: translateX(2px); transition: width var(--segmented-control-transition-duration) var(--cubic-enter), transform var(--segmented-control-transition-duration) var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Default</span><span class="ZDw29">Default</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Image input</span><span class="ZDw29">Image input</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Streaming</span><span class="ZDw29">Streaming</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Functions</span><span class="ZDw29">Functions</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="fC8KU" tabindex="-1" data-radix-collection-item=""><span class="JfMyo" aria-hidden="true">Logprobs</span><span class="ZDw29">Logprobs</span></button></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="model-select"><button id="select-trigger-radix-:r16:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r18:" data-state="closed"><span class="RWOJJ">gpt-4.1</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><div class="exclude-from-copy"><button id="select-trigger-radix-:r19:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1b:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span></code><span><span>curl https://api.openai.com/v1/chat/completions \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -d </span><span class="hljs-string">'{ | |
</span></span><span class="hljs-string"> "model": "gpt-4.1", | |
</span><span class="hljs-string"> "messages": [ | |
</span><span class="hljs-string"> { | |
</span><span class="hljs-string"> "role": "developer", | |
</span><span class="hljs-string"> "content": "You are a helpful assistant." | |
</span><span class="hljs-string"> }, | |
</span><span class="hljs-string"> { | |
</span><span class="hljs-string"> "role": "user", | |
</span><span class="hljs-string"> "content": "Hello!" | |
</span><span class="hljs-string"> } | |
</span><span class="hljs-string"> ] | |
</span><span class="hljs-string"> }'</span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span>completion = client.chat.completions.create( | |
</span><span><span> model=</span><span class="hljs-string">"gpt-4.1"</span><span>, | |
</span></span><span> messages=[ | |
</span><span><span> {</span><span class="hljs-string">"role"</span><span>: </span><span class="hljs-string">"developer"</span><span>, </span><span class="hljs-string">"content"</span><span>: </span><span class="hljs-string">"You are a helpful assistant."</span><span>}, | |
</span></span><span><span> {</span><span class="hljs-string">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, </span><span class="hljs-string">"content"</span><span>: </span><span class="hljs-string">"Hello!"</span><span>} | |
</span></span><span> ] | |
</span><span>) | |
</span><span> | |
</span><span><span></span><span class="hljs-built_in">print</span><span>(completion.choices[</span><span class="hljs-number">0</span><span>].message)</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-javascript" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span></code><span><span class="hljs-keyword">import</span><span> OpenAI </span><span class="hljs-keyword">from</span><span> </span><span class="hljs-string">"openai"</span><span>; | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">const</span><span> openai = </span><span class="hljs-keyword">new</span><span> OpenAI(); | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">async</span><span> </span><span class="hljs-function hljs-keyword">function</span><span class="hljs-function"> </span><span class="hljs-function hljs-title">main</span><span class="hljs-function">(</span><span class="hljs-function">) </span><span>{ | |
</span></span><span><span> </span><span class="hljs-keyword">const</span><span> completion = </span><span class="hljs-keyword">await</span><span> openai.chat.completions.create({ | |
</span></span><span><span> </span><span class="hljs-attr">messages</span><span>: [{ </span><span class="hljs-attr">role</span><span>: </span><span class="hljs-string">"developer"</span><span>, </span><span class="hljs-attr">content</span><span>: </span><span class="hljs-string">"You are a helpful assistant."</span><span> }], | |
</span></span><span><span> </span><span class="hljs-attr">model</span><span>: </span><span class="hljs-string">"gpt-4.1"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">store</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span> }); | |
</span><span> | |
</span><span><span> </span><span class="hljs-built_in">console</span><span>.log(completion.choices[</span><span class="hljs-number">0</span><span>]); | |
</span></span><span>} | |
</span><span> | |
</span><span>main();</span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-csharp" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span></code><span><span class="hljs-keyword">using</span><span> </span><span class="hljs-keyword">System</span><span>; | |
</span></span><span><span></span><span class="hljs-keyword">using</span><span> System.Collections.Generic; | |
</span></span><span> | |
</span><span><span></span><span class="hljs-keyword">using</span><span> OpenAI.Chat; | |
</span></span><span> | |
</span><span><span>ChatClient client </span><span class="hljs-operator">=</span><span> </span><span class="hljs-keyword">new</span><span>( | |
</span></span><span> model: "gpt-4.1", | |
</span><span> apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") | |
</span><span>); | |
</span><span> | |
</span><span><span>List</span><span class="hljs-operator"><</span><span>ChatMessage</span><span class="hljs-operator">></span><span> messages </span><span class="hljs-operator">=</span><span> | |
</span></span><span>[ | |
</span><span><span> </span><span class="hljs-keyword">new</span><span> SystemChatMessage("You are a helpful assistant."), | |
</span></span><span><span> </span><span class="hljs-keyword">new</span><span> UserChatMessage("Hello!") | |
</span></span><span>]; | |
</span><span> | |
</span><span><span>ChatCompletion completion </span><span class="hljs-operator">=</span><span> client.CompleteChat(messages); | |
</span></span><span> | |
</span><span><span>Console.WriteLine(completion.Content[</span><span class="hljs-number">0</span><span>].Text);</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1741569952</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4.1-2025-04-14"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"Hello! How can I assist you today?"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"refusal"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">19</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">10</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">29</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"cached_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"completion_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"accepted_prediction_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"rejected_prediction_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/get" class="anchor-heading" data-name="chat/get"><div class="flex flex-row items-center gap-3">Get chat completion</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-get">get</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions/{completion_id}</span></span></div><div class="endpoint-summary"><p>Get a stored chat completion. Only Chat Completions that have been created | |
with the <code>store</code> parameter set to <code>true</code> will be returned.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="chat-get__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-get-completion_id" data-anchor="chat-get-completion_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">completion_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the chat completion to retrieve.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>The <a href="/docs/api-reference/chat/object">ChatCompletion</a> object matching the specified ID.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1c:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1e:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl https://api.openai.com/v1/chat/completions/chatcmpl-abc123 \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>completions = client.chat.completions.</span><span class="hljs-built_in">list</span><span>() | |
</span></span><span><span>first_id = completions[</span><span class="hljs-number">0</span><span>].</span><span class="hljs-built_in">id</span><span> | |
</span></span><span>first_completion = client.chat.completions.retrieve(completion_id=first_id) | |
</span><span><span></span><span class="hljs-built_in">print</span><span>(first_completion)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1738960610</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"request_id"</span><span>: </span><span class="hljs-string">"req_ded8ab984ec4bf840f37566c1011c417"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">31</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">18</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">13</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"seed"</span><span>: </span><span class="hljs-number">4944116822809979520</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"presence_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"frequency_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_50cad350e4"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {}, | |
</span></span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_calls"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"function_call"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"response_format"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/getMessages" class="anchor-heading" data-name="chat/getMessages"><div class="flex flex-row items-center gap-3">Get chat messages</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-get">get</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions/{completion_id}/messages</span></span></div><div class="endpoint-summary"><p>Get the messages in a stored chat completion. Only Chat Completions that | |
have been created with the <code>store</code> parameter set to <code>true</code> will be | |
returned.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="chat-getmessages__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-getmessages-completion_id" data-anchor="chat-getmessages-completion_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">completion_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the chat completion to retrieve messages from.</p></div></div></div></div></div><div class="param-section"><h4>Query parameters</h4><div class="param-table" id="chat-getmessages__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-getmessages-after" data-anchor="chat-getmessages-after" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">after</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Identifier for the last message from the previous pagination request.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-getmessages-limit" data-anchor="chat-getmessages-limit" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">limit</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 20</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Number of messages to retrieve.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-getmessages-order" data-anchor="chat-getmessages-order" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">order</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to asc</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Sort order for messages by timestamp. Use <code>asc</code> for ascending order or <code>desc</code> for descending order. Defaults to <code>asc</code>.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>A list of <a href="/docs/api-reference/chat/message-list">messages</a> for the specified chat completion.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1f:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1h:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl https://api.openai.com/v1/chat/completions/chat_abc123/messages \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>completions = client.chat.completions.</span><span class="hljs-built_in">list</span><span>() | |
</span></span><span><span>first_id = completions[</span><span class="hljs-number">0</span><span>].</span><span class="hljs-built_in">id</span><span> | |
</span></span><span>first_completion = client.chat.completions.retrieve(completion_id=first_id) | |
</span><span><span>messages = client.chat.completions.messages.</span><span class="hljs-built_in">list</span><span>(completion_id=first_id) | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(messages)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"write a haiku about ai"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"name"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_parts"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/list" class="anchor-heading" data-name="chat/list"><div class="flex flex-row items-center gap-3">List Chat Completions</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-get">get</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions</span></span></div><div class="endpoint-summary"><p>List stored Chat Completions. Only Chat Completions that have been stored | |
with the <code>store</code> parameter set to <code>true</code> will be returned.</p></div><div class="param-section"><h4>Query parameters</h4><div class="param-table" id="chat-list__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-list-after" data-anchor="chat-list-after" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">after</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Identifier for the last chat completion from the previous pagination request.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-list-limit" data-anchor="chat-list-limit" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">limit</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 20</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Number of Chat Completions to retrieve.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-list-metadata" data-anchor="chat-list-metadata" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">metadata</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of metadata keys to filter the Chat Completions by. Example:</p> | |
<p><code>metadata[key1]=value1&metadata[key2]=value2</code></p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-list-model" data-anchor="chat-list-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The model used to generate the Chat Completions.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-list-order" data-anchor="chat-list-order" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">order</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to asc</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Sort order for Chat Completions by timestamp. Use <code>asc</code> for ascending order or <code>desc</code> for descending order. Defaults to <code>asc</code>.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>A list of <a href="/docs/api-reference/chat/list-object">Chat Completions</a> matching the specified filters.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1i:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1k:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl https://api.openai.com/v1/chat/completions \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>completions = client.chat.completions.</span><span class="hljs-built_in">list</span><span>() | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(completions)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4.1-2025-04-14"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1738960610</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"request_id"</span><span>: </span><span class="hljs-string">"req_ded8ab984ec4bf840f37566c1011c417"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">31</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">18</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">13</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"seed"</span><span>: </span><span class="hljs-number">4944116822809979520</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"presence_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"frequency_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_50cad350e4"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {}, | |
</span></span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_calls"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"function_call"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"response_format"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/update" class="anchor-heading" data-name="chat/update"><div class="flex flex-row items-center gap-3">Update chat completion</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-post">post</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions/{completion_id}</span></span></div><div class="endpoint-summary"><p>Modify a stored chat completion. Only Chat Completions that have been | |
created with the <code>store</code> parameter set to <code>true</code> can be modified. Currently, | |
the only supported modification is to update the <code>metadata</code> field.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="chat-update__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-update-completion_id" data-anchor="chat-update-completion_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">completion_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the chat completion to update.</p></div></div></div></div></div><div class="param-section"><h4>Request body</h4><div class="param-table" id="chat-update__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-update-metadata" data-anchor="chat-update-metadata" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">metadata</div><div class="param-type"><div class="docs-markdown-content"><p>map</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Set of 16 key-value pairs that can be attached to an object. This can be | |
useful for storing additional information about the object in a structured | |
format, and querying for objects via API or the dashboard.</p> | |
<p>Keys are strings with a maximum length of 64 characters. Values are strings | |
with a maximum length of 512 characters.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>The <a href="/docs/api-reference/chat/object">ChatCompletion</a> object matching the specified ID.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1l:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1n:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>curl -X POST https://api.openai.com/v1/chat/completions/chat_abc123 \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -d </span><span class="hljs-string">'{"metadata": {"foo": "bar"}}'</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>completions = client.chat.completions.</span><span class="hljs-built_in">list</span><span>() | |
</span></span><span><span>first_id = completions[</span><span class="hljs-number">0</span><span>].</span><span class="hljs-built_in">id</span><span> | |
</span></span><span><span>updated_completion = client.chat.completions.update(completion_id=first_id, request_body={</span><span class="hljs-string">"metadata"</span><span>: {</span><span class="hljs-string">"foo"</span><span>: </span><span class="hljs-string">"bar"</span><span>}}) | |
</span></span><span><span></span><span class="hljs-built_in">print</span><span>(updated_completion)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1738960610</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"request_id"</span><span>: </span><span class="hljs-string">"req_ded8ab984ec4bf840f37566c1011c417"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">31</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">18</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">13</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"seed"</span><span>: </span><span class="hljs-number">4944116822809979520</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"presence_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"frequency_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_50cad350e4"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"foo"</span><span>: </span><span class="hljs-string">"bar"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_calls"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"function_call"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"response_format"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/delete" class="anchor-heading" data-name="chat/delete"><div class="flex flex-row items-center gap-3">Delete chat completion</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-delete">delete</span> <span class="endpoint-path">https://api.openai.com/v1/chat/completions/{completion_id}</span></span></div><div class="endpoint-summary"><p>Delete a stored chat completion. Only Chat Completions that have been | |
created with the <code>store</code> parameter set to <code>true</code> can be deleted.</p></div><div class="param-section"><h4>Path parameters</h4><div class="param-table" id="chat-delete__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-delete-completion_id" data-anchor="chat-delete-completion_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">completion_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-reqd">Required</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the chat completion to delete.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>A deletion confirmation object.</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1o:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1q:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span></code><span><span>curl -X DELETE https://api.openai.com/v1/chat/completions/chat_abc123 \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span></span></code></pre></div><div class="code-block hidden"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-python" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span class="hljs-keyword">from</span><span> openai </span><span class="hljs-keyword">import</span><span> OpenAI | |
</span></span><span>client = OpenAI() | |
</span><span> | |
</span><span><span>completions = client.chat.completions.</span><span class="hljs-built_in">list</span><span>() | |
</span></span><span><span>first_id = completions[</span><span class="hljs-number">0</span><span>].</span><span class="hljs-built_in">id</span><span> | |
</span></span><span>delete_response = client.chat.completions.delete(completion_id=first_id) | |
</span><span><span></span><span class="hljs-built_in">print</span><span>(delete_response)</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion.deleted"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"deleted"</span><span>: </span><span class="hljs-literal">true</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/object" class="anchor-heading" data-name="chat/object"><div class="flex flex-row items-center gap-3">The chat completion object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Represents a chat completion response returned by model, based on the provided input.</p></div><div class="param-table" id="chat/object__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-choices" data-anchor="chat/object-choices" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">choices</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of chat completion choices. Can be more than one if <code>n</code> is greater than 1.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat/object-choices_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-created" data-anchor="chat/object-created" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">created</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The Unix timestamp (in seconds) of when the chat completion was created.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-id" data-anchor="chat/object-id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A unique identifier for the chat completion.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-model" data-anchor="chat/object-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The model used for the chat completion.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-object" data-anchor="chat/object-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The object type, which is always <code>chat.completion</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-service_tier" data-anchor="chat/object-service_tier" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">service_tier</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:</p> | |
<ul> | |
<li>If set to 'auto', and the Project is Scale tier enabled, the system | |
will utilize scale tier credits until they are exhausted.</li> | |
<li>If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'flex', the request will be processed with the Flex Processing service tier. <a href="/docs/guides/flex-processing">Learn more</a>.</li> | |
<li>When not set, the default behavior is 'auto'.</li> | |
</ul> | |
<p>When this parameter is set, the response body will include the <code>service_tier</code> utilized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-system_fingerprint" data-anchor="chat/object-system_fingerprint" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">system_fingerprint</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>This fingerprint represents the backend configuration that the model runs with.</p> | |
<p>Can be used in conjunction with the <code>seed</code> request parameter to understand when backend changes have been made that might impact determinism.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/object-usage" data-anchor="chat/object-usage" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">usage</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Usage statistics for the completion request.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat/object-usage_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The chat completion object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1741570283</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"refusal"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"annotations"</span><span>: [] | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">1117</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">46</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">1163</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"cached_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"completion_tokens_details"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"reasoning_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"accepted_prediction_tokens"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"rejected_prediction_tokens"</span><span>: </span><span class="hljs-number">0</span><span> | |
</span></span><span> } | |
</span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_fc9f1d7035"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/list-object" class="anchor-heading" data-name="chat/list-object"><div class="flex flex-row items-center gap-3">The chat completion list object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>An object representing a list of Chat Completions.</p></div><div class="param-table" id="chat/list-object__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/list-object-data" data-anchor="chat/list-object-data" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">data</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An array of chat completion objects.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat/list-object-data_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/list-object-first_id" data-anchor="chat/list-object-first_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">first_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The identifier of the first chat completion in the data array.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/list-object-has_more" data-anchor="chat/list-object-has_more" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">has_more</div><div class="param-type"><div class="docs-markdown-content"><p>boolean</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Indicates whether there are more Chat Completions available.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/list-object-last_id" data-anchor="chat/list-object-last_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">last_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The identifier of the last chat completion in the data array.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/list-object-object" data-anchor="chat/list-object-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of this object. It is always set to "list".</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The chat completion list object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span><span class="react-syntax-highlighter-line-number">39 | |
</span><span class="react-syntax-highlighter-line-number">40 | |
</span><span class="react-syntax-highlighter-line-number">41 | |
</span><span class="react-syntax-highlighter-line-number">42 | |
</span><span class="react-syntax-highlighter-line-number">43 | |
</span><span class="react-syntax-highlighter-line-number">44 | |
</span><span class="react-syntax-highlighter-line-number">45 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"chat.completion"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-2024-08-06"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"created"</span><span>: </span><span class="hljs-number">1738960610</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"request_id"</span><span>: </span><span class="hljs-string">"req_ded8ab984ec4bf840f37566c1011c417"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"usage"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"total_tokens"</span><span>: </span><span class="hljs-number">31</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"completion_tokens"</span><span>: </span><span class="hljs-number">18</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt_tokens"</span><span>: </span><span class="hljs-number">13</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"seed"</span><span>: </span><span class="hljs-number">4944116822809979520</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"top_p"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">1.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"presence_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"frequency_penalty"</span><span>: </span><span class="hljs-number">0.0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_50cad350e4"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_user"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"service_tier"</span><span>: </span><span class="hljs-string">"default"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"metadata"</span><span>: {}, | |
</span></span><span><span> </span><span class="hljs-attr">"choices"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"assistant"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tool_calls"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"function_call"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"finish_reason"</span><span>: </span><span class="hljs-string">"stop"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"logprobs"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"response_format"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat/message-list" class="anchor-heading" data-name="chat/message-list"><div class="flex flex-row items-center gap-3">The chat completion message list object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>An object representing a list of chat completion messages.</p></div><div class="param-table" id="chat/message-list__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/message-list-data" data-anchor="chat/message-list-data" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">data</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>An array of chat completion message objects.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat/message-list-data_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/message-list-first_id" data-anchor="chat/message-list-first_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">first_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The identifier of the first chat message in the data array.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/message-list-has_more" data-anchor="chat/message-list-has_more" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">has_more</div><div class="param-type"><div class="docs-markdown-content"><p>boolean</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Indicates whether there are more chat messages available.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/message-list-last_id" data-anchor="chat/message-list-last_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">last_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The identifier of the last chat message in the data array.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat/message-list-object" data-anchor="chat/message-list-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The type of this object. It is always set to "list".</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The chat completion message list object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"list"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"data"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: </span><span class="hljs-string">"write a haiku about ai"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"name"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_parts"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"first_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"last_id"</span><span>: </span><span class="hljs-string">"chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"has_more"</span><span>: </span><span class="hljs-literal">false</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="chat-streaming" class="anchor-heading" data-name="chat-streaming"><div class="flex flex-row items-center gap-3">Streaming</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>Stream Chat Completions in real time. Receive chunks of completions | |
returned from the model using server-sent events. | |
<a href="/docs/guides/streaming-responses?api-mode=chat">Learn more</a>.</p></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="chat-streaming/streaming" class="anchor-heading" data-name="chat-streaming/streaming"><div class="flex flex-row items-center gap-3">The chat completion chunk object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Represents a streamed chunk of a chat completion response returned | |
by the model, based on the provided input. | |
<a href="/docs/guides/streaming-responses">Learn more</a>.</p></div><div class="param-table" id="chat-streaming/streaming__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-choices" data-anchor="chat-streaming/streaming-choices" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">choices</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A list of chat completion choices. Can contain more than one elements if <code>n</code> is greater than 1. Can also be empty for the | |
last chunk if you set <code>stream_options: {"include_usage": true}</code>.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-streaming/streaming-choices_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-created" data-anchor="chat-streaming/streaming-created" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">created</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-id" data-anchor="chat-streaming/streaming-id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A unique identifier for the chat completion. Each chunk has the same ID.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-model" data-anchor="chat-streaming/streaming-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The model to generate the completion.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-object" data-anchor="chat-streaming/streaming-object" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">object</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The object type, which is always <code>chat.completion.chunk</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-service_tier" data-anchor="chat-streaming/streaming-service_tier" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">service_tier</div><div class="param-type"><div class="docs-markdown-content"><p>string or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:</p> | |
<ul> | |
<li>If set to 'auto', and the Project is Scale tier enabled, the system | |
will utilize scale tier credits until they are exhausted.</li> | |
<li>If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.</li> | |
<li>If set to 'flex', the request will be processed with the Flex Processing service tier. <a href="/docs/guides/flex-processing">Learn more</a>.</li> | |
<li>When not set, the default behavior is 'auto'.</li> | |
</ul> | |
<p>When this parameter is set, the response body will include the <code>service_tier</code> utilized.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-system_fingerprint" data-anchor="chat-streaming/streaming-system_fingerprint" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">system_fingerprint</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>This fingerprint represents the backend configuration that the model runs with. | |
Can be used in conjunction with the <code>seed</code> request parameter to understand when backend changes have been made that might impact determinism.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#chat-streaming/streaming-usage" data-anchor="chat-streaming/streaming-usage" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">usage</div><div class="param-type"><div class="docs-markdown-content"><p>object or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Usage statistics for the completion request.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="chat-streaming/streaming-usage_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The chat completion chunk object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{</span><span class="hljs-attr">"id"</span><span>:</span><span class="hljs-string">"chatcmpl-123"</span><span>,</span><span class="hljs-attr">"object"</span><span>:</span><span class="hljs-string">"chat.completion.chunk"</span><span>,</span><span class="hljs-attr">"created"</span><span>:</span><span class="hljs-number">1694268190</span><span>,</span><span class="hljs-attr">"model"</span><span>:</span><span class="hljs-string">"gpt-4o-mini"</span><span>, </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_44709d6fcb"</span><span>, </span><span class="hljs-attr">"choices"</span><span>:[{</span><span class="hljs-attr">"index"</span><span>:</span><span class="hljs-number">0</span><span>,</span><span class="hljs-attr">"delta"</span><span>:{</span><span class="hljs-attr">"role"</span><span>:</span><span class="hljs-string">"assistant"</span><span>,</span><span class="hljs-attr">"content"</span><span>:</span><span class="hljs-string">""</span><span>},</span><span class="hljs-attr">"logprobs"</span><span>:</span><span class="hljs-literal">null</span><span>,</span><span class="hljs-attr">"finish_reason"</span><span>:</span><span class="hljs-literal">null</span><span>}]} | |
</span></span><span> | |
</span><span><span>{</span><span class="hljs-attr">"id"</span><span>:</span><span class="hljs-string">"chatcmpl-123"</span><span>,</span><span class="hljs-attr">"object"</span><span>:</span><span class="hljs-string">"chat.completion.chunk"</span><span>,</span><span class="hljs-attr">"created"</span><span>:</span><span class="hljs-number">1694268190</span><span>,</span><span class="hljs-attr">"model"</span><span>:</span><span class="hljs-string">"gpt-4o-mini"</span><span>, </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_44709d6fcb"</span><span>, </span><span class="hljs-attr">"choices"</span><span>:[{</span><span class="hljs-attr">"index"</span><span>:</span><span class="hljs-number">0</span><span>,</span><span class="hljs-attr">"delta"</span><span>:{</span><span class="hljs-attr">"content"</span><span>:</span><span class="hljs-string">"Hello"</span><span>},</span><span class="hljs-attr">"logprobs"</span><span>:</span><span class="hljs-literal">null</span><span>,</span><span class="hljs-attr">"finish_reason"</span><span>:</span><span class="hljs-literal">null</span><span>}]} | |
</span></span><span> | |
</span><span>.... | |
</span><span> | |
</span><span><span>{</span><span class="hljs-attr">"id"</span><span>:</span><span class="hljs-string">"chatcmpl-123"</span><span>,</span><span class="hljs-attr">"object"</span><span>:</span><span class="hljs-string">"chat.completion.chunk"</span><span>,</span><span class="hljs-attr">"created"</span><span>:</span><span class="hljs-number">1694268190</span><span>,</span><span class="hljs-attr">"model"</span><span>:</span><span class="hljs-string">"gpt-4o-mini"</span><span>, </span><span class="hljs-attr">"system_fingerprint"</span><span>: </span><span class="hljs-string">"fp_44709d6fcb"</span><span>, </span><span class="hljs-attr">"choices"</span><span>:[{</span><span class="hljs-attr">"index"</span><span>:</span><span class="hljs-number">0</span><span>,</span><span class="hljs-attr">"delta"</span><span>:{},</span><span class="hljs-attr">"logprobs"</span><span>:</span><span class="hljs-literal">null</span><span>,</span><span class="hljs-attr">"finish_reason"</span><span>:</span><span class="hljs-string">"stop"</span><span>}]}</span></span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="realtime" class="anchor-heading" data-name="realtime"><div class="flex flex-row items-center gap-3">Realtime<div class="qB3Oq" data-color="warning" data-size="md" data-variant="filled"><span class="BWpH-" data-size="md">Beta</span></div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>Communicate with a GPT-4o class model in real time using WebRTC or | |
WebSockets. Supports text and audio inputs and ouputs, along with audio | |
transcriptions. | |
<a href="/docs/guides/realtime">Learn more about the Realtime API</a>.</p></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="realtime-sessions" class="anchor-heading" data-name="realtime-sessions"><div class="flex flex-row items-center gap-3">Session tokens</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>REST API endpoint to generate ephemeral session tokens for use in client-side | |
applications.</p></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-sessions/create" class="anchor-heading" data-name="realtime-sessions/create"><div class="flex flex-row items-center gap-3">Create session</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-post">post</span> <span class="endpoint-path">https://api.openai.com/v1/realtime/sessions</span></span></div><div class="endpoint-summary"><p>Create an ephemeral API token for use in client-side applications with the | |
Realtime API. Can be configured with the same session parameters as the | |
<code>session.update</code> client event.</p> | |
<p>It responds with a session object, plus a <code>client_secret</code> key which contains | |
a usable ephemeral API token that can be used to authenticate browser clients | |
for the Realtime API.</p></div><div class="param-section"><h4>Request body</h4><div class="param-table" id="realtime-sessions-create__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-input_audio_format" data-anchor="realtime-sessions-create-input_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to pcm16</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of input audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>. | |
For <code>pcm16</code>, input audio must be 16-bit PCM at a 24kHz sample rate, | |
single channel (mono), and little-endian byte order.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-input_audio_noise_reduction" data-anchor="realtime-sessions-create-input_audio_noise_reduction" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_noise_reduction</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to null</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for input audio noise reduction. This can be set to <code>null</code> to turn off. | |
Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. | |
Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-input_audio_noise_reduction_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-input_audio_transcription" data-anchor="realtime-sessions-create-input_audio_transcription" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_transcription</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for input audio transcription, defaults to off and can be set to <code>null</code> to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through <a href="https://platform.openai.com/docs/api-reference/audio/createTranscription" target="_blank" rel="noopener noreferrer">the /audio/transcriptions endpoint</a> and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-input_audio_transcription_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-instructions" data-anchor="realtime-sessions-create-instructions" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">instructions</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.</p> | |
<p>Note that the server sets default instructions which will be used if this field is not set and are visible in the <code>session.created</code> event at the start of the session.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-max_response_output_tokens" data-anchor="realtime-sessions-create-max_response_output_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_response_output_tokens</div><div class="param-type"><div class="docs-markdown-content"><p>integer or "inf"</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Maximum number of output tokens for a single assistant response, | |
inclusive of tool calls. Provide an integer between 1 and 4096 to | |
limit output tokens, or <code>inf</code> for the maximum available tokens for a | |
given model. Defaults to <code>inf</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-modalities" data-anchor="realtime-sessions-create-modalities" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">modalities</div><div class="param-type"><div class="docs-markdown-content"></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The set of modalities the model can respond with. To disable audio, | |
set this to ["text"].</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-model" data-anchor="realtime-sessions-create-model" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">model</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The Realtime model used for this session.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-output_audio_format" data-anchor="realtime-sessions-create-output_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to pcm16</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of output audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>. | |
For <code>pcm16</code>, output audio is sampled at a rate of 24kHz.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-temperature" data-anchor="realtime-sessions-create-temperature" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">temperature</div><div class="param-type"><div class="docs-markdown-content"><p>number</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to 0.8</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-tool_choice" data-anchor="realtime-sessions-create-tool_choice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tool_choice</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to auto</div></div><div class="param-desc"><div class="docs-markdown-content"><p>How the model chooses tools. Options are <code>auto</code>, <code>none</code>, <code>required</code>, or | |
specify a function.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-tools" data-anchor="realtime-sessions-create-tools" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tools</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Tools (functions) available to the model.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-tools_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-turn_detection" data-anchor="realtime-sessions-create-turn_detection" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">turn_detection</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to <code>null</code> to turn off, in which case the client must manually trigger model response. | |
Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. | |
Semantic VAD is more advanced and uses a turn detection model (in conjuction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-turn_detection_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-voice" data-anchor="realtime-sessions-create-voice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">voice</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The voice the model uses to respond. Voice cannot be changed during the | |
session once the model has responded with audio at least once. Current | |
voice options are <code>alloy</code>, <code>ash</code>, <code>ballad</code>, <code>coral</code>, <code>echo</code>, <code>fable</code>, | |
<code>onyx</code>, <code>nova</code>, <code>sage</code>, <code>shimmer</code>, and <code>verse</code>.</p></div></div></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>The created Realtime session object, plus an ephemeral key</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1r:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r1t:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span></code><span><span>curl -X POST https://api.openai.com/v1/realtime/sessions \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -d </span><span class="hljs-string">'{ | |
</span></span><span class="hljs-string"> "model": "gpt-4o-realtime-preview", | |
</span><span class="hljs-string"> "modalities": ["audio", "text"], | |
</span><span class="hljs-string"> "instructions": "You are a friendly assistant." | |
</span><span class="hljs-string"> }'</span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-realtime-preview"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"audio"</span><span>, </span><span class="hljs-string">"text"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"You are a friendly assistant."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"alloy"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"whisper-1"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"none"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.7</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_response_output_tokens"</span><span>: </span><span class="hljs-number">200</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"client_secret"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"value"</span><span>: </span><span class="hljs-string">"ek_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"expires_at"</span><span>: </span><span class="hljs-number">1234567890</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-sessions/create-transcription" class="anchor-heading" data-name="realtime-sessions/create-transcription"><div class="flex flex-row items-center gap-3">Create transcription session</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div><span class="endpoint-text"><span class="endpoint-method endpoint-method-post">post</span> <span class="endpoint-path">https://api.openai.com/v1/realtime/transcription_sessions</span></span></div><div class="endpoint-summary"><p>Create an ephemeral API token for use in client-side applications with the | |
Realtime API specifically for realtime transcriptions. | |
Can be configured with the same session parameters as the <code>transcription_session.update</code> client event.</p> | |
<p>It responds with a session object, plus a <code>client_secret</code> key which contains | |
a usable ephemeral API token that can be used to authenticate browser clients | |
for the Realtime API.</p></div><div class="param-section"><h4>Request body</h4><div class="param-table" id="realtime-sessions-create-transcription__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-include" data-anchor="realtime-sessions-create-transcription-include" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">include</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The set of items to include in the transcription. Current available items are:</p> | |
<p>null.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-input_audio_format" data-anchor="realtime-sessions-create-transcription-input_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to pcm16</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of input audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>. | |
For <code>pcm16</code>, input audio must be 16-bit PCM at a 24kHz sample rate, | |
single channel (mono), and little-endian byte order.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-input_audio_noise_reduction" data-anchor="realtime-sessions-create-transcription-input_audio_noise_reduction" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_noise_reduction</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div><div class="param-default">Defaults to null</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for input audio noise reduction. This can be set to <code>null</code> to turn off. | |
Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. | |
Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-transcription-input_audio_noise_reduction_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-input_audio_transcription" data-anchor="realtime-sessions-create-transcription-input_audio_transcription" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_transcription</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-transcription-input_audio_transcription_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-modalities" data-anchor="realtime-sessions-create-transcription-modalities" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">modalities</div><div class="param-type"><div class="docs-markdown-content"></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>The set of modalities the model can respond with. To disable audio, | |
set this to ["text"].</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions-create-transcription-turn_detection" data-anchor="realtime-sessions-create-transcription-turn_detection" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">turn_detection</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div><div class="param-optl">Optional</div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to <code>null</code> to turn off, in which case the client must manually trigger model response. | |
Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. | |
Semantic VAD is more advanced and uses a turn detection model (in conjuction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions-create-transcription-turn_detection_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div></div></div><div class="param-section"><h4>Returns</h4><div class="param-table"><div class="param-row"><div class="docs-markdown-content"><p>The created <a href="/docs/api-reference/realtime-sessions/transcription_session_object">Realtime transcription session object</a>, plus an ephemeral key</p></div></div></div></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Example request</div><div class="exclude-from-copy"><button id="select-trigger-radix-:r1u:" type="button" class="ICo9Y" data-variant="bare" data-size="sm" data-gutter-size="xs" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-:r20:" data-state="closed"><span class="RWOJJ">curl</span><div class="relative flex items-center gap-2"><svg width="8" height="11" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="uF-Qb"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"></path></svg></div></button></div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><div class="code-block"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-bash" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>curl -X POST https://api.openai.com/v1/realtime/transcription_sessions \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Authorization: Bearer </span><span class="hljs-string hljs-variable">$OPENAI_API_KEY</span><span class="hljs-string">"</span><span> \ | |
</span></span><span><span> -H </span><span class="hljs-string">"Content-Type: application/json"</span><span> \ | |
</span></span><span><span> -d </span><span class="hljs-string">'{}'</span></span></code></pre></div></div></div><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">Response</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-json" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_BBwZc7cFV3XizEyKGDCGL"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.transcription_session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"audio"</span><span>, </span><span class="hljs-string">"text"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"server_vad"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"threshold"</span><span>: </span><span class="hljs-number">0.5</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prefix_padding_ms"</span><span>: </span><span class="hljs-number">300</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"silence_duration_ms"</span><span>: </span><span class="hljs-number">200</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-transcribe"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"language"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt"</span><span>: </span><span class="hljs-string">""</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"client_secret"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-sessions/session_object" class="anchor-heading" data-name="realtime-sessions/session_object"><div class="flex flex-row items-center gap-3">The session object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>A new Realtime session configuration, with an ephermeral key. Default TTL | |
for keys is one minute.</p></div><div class="param-table" id="realtime-sessions/session_object__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-client_secret" data-anchor="realtime-sessions/session_object-client_secret" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">client_secret</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Ephemeral key returned by the API.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/session_object-client_secret_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-input_audio_format" data-anchor="realtime-sessions/session_object-input_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of input audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-input_audio_transcription" data-anchor="realtime-sessions/session_object-input_audio_transcription" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_transcription</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for input audio transcription, defaults to off and can be | |
set to <code>null</code> to turn off once on. Input audio transcription is not native | |
to the model, since the model consumes audio directly. Transcription runs | |
asynchronously through Whisper and should be treated as rough guidance | |
rather than the representation understood by the model.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/session_object-input_audio_transcription_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-instructions" data-anchor="realtime-sessions/session_object-instructions" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">instructions</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The default system instructions (i.e. system message) prepended to model | |
calls. This field allows the client to guide the model on desired | |
responses. The model can be instructed on response content and format, | |
(e.g. "be extremely succinct", "act friendly", "here are examples of good | |
responses") and on audio behavior (e.g. "talk quickly", "inject emotion | |
into your voice", "laugh frequently"). The instructions are not guaranteed | |
to be followed by the model, but they provide guidance to the model on the | |
desired behavior.</p> | |
<p>Note that the server sets default instructions which will be used if this | |
field is not set and are visible in the <code>session.created</code> event at the | |
start of the session.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-max_response_output_tokens" data-anchor="realtime-sessions/session_object-max_response_output_tokens" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">max_response_output_tokens</div><div class="param-type"><div class="docs-markdown-content"><p>integer or "inf"</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Maximum number of output tokens for a single assistant response, | |
inclusive of tool calls. Provide an integer between 1 and 4096 to | |
limit output tokens, or <code>inf</code> for the maximum available tokens for a | |
given model. Defaults to <code>inf</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-modalities" data-anchor="realtime-sessions/session_object-modalities" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">modalities</div><div class="param-type"><div class="docs-markdown-content"></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The set of modalities the model can respond with. To disable audio, | |
set this to ["text"].</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-output_audio_format" data-anchor="realtime-sessions/session_object-output_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">output_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of output audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-temperature" data-anchor="realtime-sessions/session_object-temperature" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">temperature</div><div class="param-type"><div class="docs-markdown-content"><p>number</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-tool_choice" data-anchor="realtime-sessions/session_object-tool_choice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tool_choice</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>How the model chooses tools. Options are <code>auto</code>, <code>none</code>, <code>required</code>, or | |
specify a function.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-tools" data-anchor="realtime-sessions/session_object-tools" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">tools</div><div class="param-type"><div class="docs-markdown-content"><p>array</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Tools (functions) available to the model.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/session_object-tools_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-turn_detection" data-anchor="realtime-sessions/session_object-turn_detection" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">turn_detection</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for turn detection. Can be set to <code>null</code> to turn off. Server | |
VAD means that the model will detect the start and end of speech based on | |
audio volume and respond at the end of user speech.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/session_object-turn_detection_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/session_object-voice" data-anchor="realtime-sessions/session_object-voice" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">voice</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The voice the model uses to respond. Voice cannot be changed during the | |
session once the model has responded with audio at least once. Current | |
voice options are <code>alloy</code>, <code>ash</code>, <code>ballad</code>, <code>coral</code>, <code>echo</code> <code>sage</code>, | |
<code>shimmer</code> and <code>verse</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The session object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-realtime-preview"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"audio"</span><span>, </span><span class="hljs-string">"text"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"You are a friendly assistant."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"alloy"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"whisper-1"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"none"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.7</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_response_output_tokens"</span><span>: </span><span class="hljs-number">200</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"client_secret"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"value"</span><span>: </span><span class="hljs-string">"ek_abc123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"expires_at"</span><span>: </span><span class="hljs-number">1234567890</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-sessions/transcription_session_object" class="anchor-heading" data-name="realtime-sessions/transcription_session_object"><div class="flex flex-row items-center gap-3">The transcription session object</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>A new Realtime transcription session configuration.</p> | |
<p>When a session is created on the server via REST API, the session object | |
also contains an ephemeral key. Default TTL for keys is one minute. This | |
property is not present when a session is updated via the WebSocket API.</p></div><div class="param-table" id="realtime-sessions/transcription_session_object__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/transcription_session_object-client_secret" data-anchor="realtime-sessions/transcription_session_object-client_secret" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">client_secret</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Ephemeral key returned by the API. Only present when the session is | |
created on the server via REST API.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/transcription_session_object-client_secret_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/transcription_session_object-input_audio_format" data-anchor="realtime-sessions/transcription_session_object-input_audio_format" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_format</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The format of input audio. Options are <code>pcm16</code>, <code>g711_ulaw</code>, or <code>g711_alaw</code>.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/transcription_session_object-input_audio_transcription" data-anchor="realtime-sessions/transcription_session_object-input_audio_transcription" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">input_audio_transcription</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration of the transcription model.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/transcription_session_object-input_audio_transcription_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/transcription_session_object-modalities" data-anchor="realtime-sessions/transcription_session_object-modalities" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">modalities</div><div class="param-type"><div class="docs-markdown-content"></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The set of modalities the model can respond with. To disable audio, | |
set this to ["text"].</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-sessions/transcription_session_object-turn_detection" data-anchor="realtime-sessions/transcription_session_object-turn_detection" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">turn_detection</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Configuration for turn detection. Can be set to <code>null</code> to turn off. Server | |
VAD means that the model will detect the start and end of speech based on | |
audio volume and respond at the end of user speech.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-sessions/transcription_session_object-turn_detection_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT The transcription session object</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_BBwZc7cFV3XizEyKGDCGL"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.transcription_session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"expires_at"</span><span>: </span><span class="hljs-number">1742188264</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"audio"</span><span>, </span><span class="hljs-string">"text"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"server_vad"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"threshold"</span><span>: </span><span class="hljs-number">0.5</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prefix_padding_ms"</span><span>: </span><span class="hljs-number">300</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"silence_duration_ms"</span><span>: </span><span class="hljs-number">200</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-transcribe"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"language"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt"</span><span>: </span><span class="hljs-string">""</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"client_secret"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events" class="anchor-heading" data-name="realtime-client-events"><div class="flex flex-row items-center gap-3">Client events</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>These are events that the OpenAI Realtime WebSocket server will accept from the client.</p></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/session" class="anchor-heading" data-name="realtime-client-events/session"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/session/update" class="anchor-heading" data-name="realtime-client-events/session/update"><div class="flex flex-row items-center gap-3">session.update</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to update the session’s default configuration. | |
The client may send this event at any time to update any field, | |
except for <code>voice</code>. However, note that once a session has been | |
initialized with a particular <code>model</code>, it can’t be changed to | |
another model using <code>session.update</code>.</p> | |
<p>When the server receives a <code>session.update</code>, it will respond | |
with a <code>session.updated</code> event showing the full, effective configuration. | |
Only the fields that are present are updated. To clear a field like | |
<code>instructions</code>, pass an empty string.</p></div><div class="param-table" id="realtime-client-events/session/update__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/session/update-event_id" data-anchor="realtime-client-events/session/update-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/session/update-session" data-anchor="realtime-client-events/session/update-session" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">session</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Realtime session object configuration.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-client-events/session/update-session_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/session/update-type" data-anchor="realtime-client-events/session/update-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>session.update</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT session.update</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span><span class="react-syntax-highlighter-line-number">29 | |
</span><span class="react-syntax-highlighter-line-number">30 | |
</span><span class="react-syntax-highlighter-line-number">31 | |
</span><span class="react-syntax-highlighter-line-number">32 | |
</span><span class="react-syntax-highlighter-line-number">33 | |
</span><span class="react-syntax-highlighter-line-number">34 | |
</span><span class="react-syntax-highlighter-line-number">35 | |
</span><span class="react-syntax-highlighter-line-number">36 | |
</span><span class="react-syntax-highlighter-line-number">37 | |
</span><span class="react-syntax-highlighter-line-number">38 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_123"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"session.update"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"session"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"text"</span><span>, </span><span class="hljs-string">"audio"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"You are a helpful assistant."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"sage"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"whisper-1"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"server_vad"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"threshold"</span><span>: </span><span class="hljs-number">0.5</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prefix_padding_ms"</span><span>: </span><span class="hljs-number">300</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"silence_duration_ms"</span><span>: </span><span class="hljs-number">500</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"create_response"</span><span>: </span><span class="hljs-literal">true</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"function"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"name"</span><span>: </span><span class="hljs-string">"get_weather"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"description"</span><span>: </span><span class="hljs-string">"Get the current weather..."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"parameters"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"object"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"properties"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"location"</span><span>: { </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"string"</span><span> } | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"required"</span><span>: [</span><span class="hljs-string">"location"</span><span>] | |
</span></span><span> } | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.8</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_response_output_tokens"</span><span>: </span><span class="hljs-string">"inf"</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/input_audio_buffer" class="anchor-heading" data-name="realtime-client-events/input_audio_buffer"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/input_audio_buffer/append" class="anchor-heading" data-name="realtime-client-events/input_audio_buffer/append"><div class="flex flex-row items-center gap-3">input_audio_buffer.append</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to append audio bytes to the input audio buffer. The audio | |
buffer is temporary storage you can write to and later commit. In Server VAD | |
mode, the audio buffer is used to detect speech and the server will decide | |
when to commit. When Server VAD is disabled, you must commit the audio buffer | |
manually.</p> | |
<p>The client may choose how much audio to place in each event up to a maximum | |
of 15 MiB, for example streaming smaller chunks from the client may allow the | |
VAD to be more responsive. Unlike made other client events, the server will | |
not send a confirmation response to this event.</p></div><div class="param-table" id="realtime-client-events/input_audio_buffer/append__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/append-audio" data-anchor="realtime-client-events/input_audio_buffer/append-audio" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">audio</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Base64-encoded audio bytes. This must be in the format specified by the | |
<code>input_audio_format</code> field in the session configuration.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/append-event_id" data-anchor="realtime-client-events/input_audio_buffer/append-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/append-type" data-anchor="realtime-client-events/input_audio_buffer/append-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>input_audio_buffer.append</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT input_audio_buffer.append</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_456"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_audio_buffer.append"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio"</span><span>: </span><span class="hljs-string">"Base64EncodedAudioData"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/input_audio_buffer/commit" class="anchor-heading" data-name="realtime-client-events/input_audio_buffer/commit"><div class="flex flex-row items-center gap-3">input_audio_buffer.commit</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to commit the user input audio buffer, which will create a | |
new user message item in the conversation. This event will produce an error | |
if the input audio buffer is empty. When in Server VAD mode, the client does | |
not need to send this event, the server will commit the audio buffer | |
automatically.</p> | |
<p>Committing the input audio buffer will trigger input audio transcription | |
(if enabled in session configuration), but it will not create a response | |
from the model. The server will respond with an <code>input_audio_buffer.committed</code> | |
event.</p></div><div class="param-table" id="realtime-client-events/input_audio_buffer/commit__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/commit-event_id" data-anchor="realtime-client-events/input_audio_buffer/commit-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/commit-type" data-anchor="realtime-client-events/input_audio_buffer/commit-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>input_audio_buffer.commit</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT input_audio_buffer.commit</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_789"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_audio_buffer.commit"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/input_audio_buffer/clear" class="anchor-heading" data-name="realtime-client-events/input_audio_buffer/clear"><div class="flex flex-row items-center gap-3">input_audio_buffer.clear</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to clear the audio bytes in the buffer. The server will | |
respond with an <code>input_audio_buffer.cleared</code> event.</p></div><div class="param-table" id="realtime-client-events/input_audio_buffer/clear__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/clear-event_id" data-anchor="realtime-client-events/input_audio_buffer/clear-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/input_audio_buffer/clear-type" data-anchor="realtime-client-events/input_audio_buffer/clear-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>input_audio_buffer.clear</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT input_audio_buffer.clear</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_012"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_audio_buffer.clear"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation" class="anchor-heading" data-name="realtime-client-events/conversation"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation/item" class="anchor-heading" data-name="realtime-client-events/conversation/item"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation/item/create" class="anchor-heading" data-name="realtime-client-events/conversation/item/create"><div class="flex flex-row items-center gap-3">conversation.item.create</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Add a new Item to the Conversation's context, including messages, function | |
calls, and function call responses. This event can be used both to populate a | |
"history" of the conversation and to add new items mid-stream, but has the | |
current limitation that it cannot populate assistant audio messages.</p> | |
<p>If successful, the server will respond with a <code>conversation.item.created</code> | |
event, otherwise an <code>error</code> event will be sent.</p></div><div class="param-table" id="realtime-client-events/conversation/item/create__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/create-event_id" data-anchor="realtime-client-events/conversation/item/create-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/create-item" data-anchor="realtime-client-events/conversation/item/create-item" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The item to add to the conversation.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-client-events/conversation/item/create-item_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/create-previous_item_id" data-anchor="realtime-client-events/conversation/item/create-previous_item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">previous_item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the preceding item after which the new item will be inserted. | |
If not set, the new item will be appended to the end of the conversation. | |
If set to <code>root</code>, the new item will be added to the beginning of the conversation. | |
If set to an existing ID, it allows an item to be inserted mid-conversation. If the | |
ID cannot be found, an error will be returned and the item will not be added.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/create-type" data-anchor="realtime-client-events/conversation/item/create-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.create</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.create</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_345"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.create"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_item_id"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_text"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"text"</span><span>: </span><span class="hljs-string">"Hello, how are you?"</span><span> | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation/item/retrieve" class="anchor-heading" data-name="realtime-client-events/conversation/item/retrieve"><div class="flex flex-row items-center gap-3">conversation.item.retrieve</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD. | |
The server will respond with a <code>conversation.item.retrieved</code> event, | |
unless the item does not exist in the conversation history, in which case the | |
server will respond with an error.</p></div><div class="param-table" id="realtime-client-events/conversation/item/retrieve__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/retrieve-event_id" data-anchor="realtime-client-events/conversation/item/retrieve-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/retrieve-item_id" data-anchor="realtime-client-events/conversation/item/retrieve-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the item to retrieve.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/retrieve-type" data-anchor="realtime-client-events/conversation/item/retrieve-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.retrieve</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.retrieve</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_901"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.retrieve"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation/item/truncate" class="anchor-heading" data-name="realtime-client-events/conversation/item/truncate"><div class="flex flex-row items-center gap-3">conversation.item.truncate</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to truncate a previous assistant message’s audio. The server | |
will produce audio faster than realtime, so this event is useful when the user | |
interrupts to truncate audio that has already been sent to the client but not | |
yet played. This will synchronize the server's understanding of the audio with | |
the client's playback.</p> | |
<p>Truncating audio will delete the server-side text transcript to ensure there | |
is not text in the context that hasn't been heard by the user.</p> | |
<p>If successful, the server will respond with a <code>conversation.item.truncated</code> | |
event.</p></div><div class="param-table" id="realtime-client-events/conversation/item/truncate__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/truncate-audio_end_ms" data-anchor="realtime-client-events/conversation/item/truncate-audio_end_ms" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">audio_end_ms</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Inclusive duration up to which audio is truncated, in milliseconds. If | |
the audio_end_ms is greater than the actual audio duration, the server | |
will respond with an error.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/truncate-content_index" data-anchor="realtime-client-events/conversation/item/truncate-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part to truncate. Set this to 0.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/truncate-event_id" data-anchor="realtime-client-events/conversation/item/truncate-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/truncate-item_id" data-anchor="realtime-client-events/conversation/item/truncate-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the assistant message item to truncate. Only assistant message | |
items can be truncated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/truncate-type" data-anchor="realtime-client-events/conversation/item/truncate-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.truncate</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.truncate</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_678"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.truncate"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_002"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_end_ms"</span><span>: </span><span class="hljs-number">1500</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/conversation/item/delete" class="anchor-heading" data-name="realtime-client-events/conversation/item/delete"><div class="flex flex-row items-center gap-3">conversation.item.delete</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event when you want to remove any item from the conversation | |
history. The server will respond with a <code>conversation.item.deleted</code> event, | |
unless the item does not exist in the conversation history, in which case the | |
server will respond with an error.</p></div><div class="param-table" id="realtime-client-events/conversation/item/delete__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/delete-event_id" data-anchor="realtime-client-events/conversation/item/delete-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/delete-item_id" data-anchor="realtime-client-events/conversation/item/delete-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the item to delete.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/conversation/item/delete-type" data-anchor="realtime-client-events/conversation/item/delete-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.delete</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.delete</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_901"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.delete"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/response" class="anchor-heading" data-name="realtime-client-events/response"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/response/create" class="anchor-heading" data-name="realtime-client-events/response/create"><div class="flex flex-row items-center gap-3">response.create</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>This event instructs the server to create a Response, which means triggering | |
model inference. When in Server VAD mode, the server will create Responses | |
automatically.</p> | |
<p>A Response will include at least one Item, and may have two, in which case | |
the second will be a function call. These Items will be appended to the | |
conversation history.</p> | |
<p>The server will respond with a <code>response.created</code> event, events for Items | |
and content created, and finally a <code>response.done</code> event to indicate the | |
Response is complete.</p> | |
<p>The <code>response.create</code> event includes inference configuration like | |
<code>instructions</code>, and <code>temperature</code>. These fields will override the Session's | |
configuration for this Response only.</p></div><div class="param-table" id="realtime-client-events/response/create__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/create-event_id" data-anchor="realtime-client-events/response/create-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/create-response" data-anchor="realtime-client-events/response/create-response" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Create a new Realtime response with these parameters</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-client-events/response/create-response_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/create-type" data-anchor="realtime-client-events/response/create-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>response.create</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.create</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span><span class="react-syntax-highlighter-line-number">26 | |
</span><span class="react-syntax-highlighter-line-number">27 | |
</span><span class="react-syntax-highlighter-line-number">28 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_234"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.create"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"response"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"text"</span><span>, </span><span class="hljs-string">"audio"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"Please assist the user."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"sage"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"function"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"name"</span><span>: </span><span class="hljs-string">"calculate_sum"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"description"</span><span>: </span><span class="hljs-string">"Calculates the sum of two numbers."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"parameters"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"object"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"properties"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"a"</span><span>: { </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"number"</span><span> }, | |
</span></span><span><span> </span><span class="hljs-attr">"b"</span><span>: { </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"number"</span><span> } | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"required"</span><span>: [</span><span class="hljs-string">"a"</span><span>, </span><span class="hljs-string">"b"</span><span>] | |
</span></span><span> } | |
</span><span> } | |
</span><span> ], | |
</span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.8</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_output_tokens"</span><span>: </span><span class="hljs-number">1024</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/response/cancel" class="anchor-heading" data-name="realtime-client-events/response/cancel"><div class="flex flex-row items-center gap-3">response.cancel</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to cancel an in-progress response. The server will respond | |
with a <code>response.cancelled</code> event or an error if there is no response to | |
cancel.</p></div><div class="param-table" id="realtime-client-events/response/cancel__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/cancel-event_id" data-anchor="realtime-client-events/response/cancel-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/cancel-response_id" data-anchor="realtime-client-events/response/cancel-response_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">response_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>A specific response ID to cancel - if not provided, will cancel an | |
in-progress response in the default conversation.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/response/cancel-type" data-anchor="realtime-client-events/response/cancel-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>response.cancel</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT response.cancel</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_567"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"response.cancel"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/transcription_session" class="anchor-heading" data-name="realtime-client-events/transcription_session"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-client-events/transcription_session/update" class="anchor-heading" data-name="realtime-client-events/transcription_session/update"><div class="flex flex-row items-center gap-3">transcription_session.update</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Send this event to update a transcription session.</p></div><div class="param-table" id="realtime-client-events/transcription_session/update__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/transcription_session/update-event_id" data-anchor="realtime-client-events/transcription_session/update-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Optional client-generated ID used to identify this event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/transcription_session/update-session" data-anchor="realtime-client-events/transcription_session/update-session" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">session</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Realtime transcription session object configuration.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-client-events/transcription_session/update-session_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-client-events/transcription_session/update-type" data-anchor="realtime-client-events/transcription_session/update-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>transcription_session.update</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT transcription_session.update</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"transcription_session.update"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"session"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-transcribe"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prompt"</span><span>: </span><span class="hljs-string">""</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"language"</span><span>: </span><span class="hljs-string">""</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"server_vad"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"threshold"</span><span>: </span><span class="hljs-number">0.5</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prefix_padding_ms"</span><span>: </span><span class="hljs-number">300</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"silence_duration_ms"</span><span>: </span><span class="hljs-number">500</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"create_response"</span><span>: </span><span class="hljs-literal">true</span><span>, | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"input_audio_noise_reduction"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"near_field"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"include"</span><span>: [ | |
</span></span><span><span> </span><span class="hljs-string">"item.input_audio_transcription.logprobs"</span><span>, | |
</span></span><span> ] | |
</span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section md"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events" class="anchor-heading" data-name="realtime-server-events"><div class="flex flex-row items-center gap-3">Server events</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="docs-markdown-content"><p>These are events emitted from the OpenAI Realtime WebSocket server to the client.</p></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/error" class="anchor-heading" data-name="realtime-server-events/error"><div class="flex flex-row items-center gap-3">error</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when an error occurs, which could be a client problem or a server | |
problem. Most errors are recoverable and the session will stay open, we | |
recommend to implementors to monitor and log error messages by default.</p></div><div class="param-table" id="realtime-server-events/error__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/error-error" data-anchor="realtime-server-events/error-error" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">error</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Details of the error.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/error-error_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/error-event_id" data-anchor="realtime-server-events/error-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/error-type" data-anchor="realtime-server-events/error-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>error</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT error</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_890"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"error"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"invalid_request_error"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"code"</span><span>: </span><span class="hljs-string">"invalid_event"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: </span><span class="hljs-string">"The 'type' field is missing."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"param"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_567"</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/session" class="anchor-heading" data-name="realtime-server-events/session"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/session/created" class="anchor-heading" data-name="realtime-server-events/session/created"><div class="flex flex-row items-center gap-3">session.created</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when a Session is created. Emitted automatically when a new | |
connection is established as the first server event. This event will contain | |
the default Session configuration.</p></div><div class="param-table" id="realtime-server-events/session/created__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/created-event_id" data-anchor="realtime-server-events/session/created-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/created-session" data-anchor="realtime-server-events/session/created-session" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">session</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Realtime session object configuration.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/session/created-session_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/created-type" data-anchor="realtime-server-events/session/created-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>session.created</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT session.created</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span><span class="react-syntax-highlighter-line-number">23 | |
</span><span class="react-syntax-highlighter-line-number">24 | |
</span><span class="react-syntax-highlighter-line-number">25 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_1234"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"session.created"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"session"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-realtime-preview"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"text"</span><span>, </span><span class="hljs-string">"audio"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"...model instructions here..."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"sage"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"server_vad"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"threshold"</span><span>: </span><span class="hljs-number">0.5</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"prefix_padding_ms"</span><span>: </span><span class="hljs-number">300</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"silence_duration_ms"</span><span>: </span><span class="hljs-number">200</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"auto"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.8</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_response_output_tokens"</span><span>: </span><span class="hljs-string">"inf"</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/session/updated" class="anchor-heading" data-name="realtime-server-events/session/updated"><div class="flex flex-row items-center gap-3">session.updated</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when a session is updated with a <code>session.update</code> event, unless | |
there is an error.</p></div><div class="param-table" id="realtime-server-events/session/updated__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/updated-event_id" data-anchor="realtime-server-events/session/updated-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/updated-session" data-anchor="realtime-server-events/session/updated-session" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">session</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Realtime session object configuration.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/session/updated-session_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/session/updated-type" data-anchor="realtime-server-events/session/updated-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>session.updated</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT session.updated</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span><span class="react-syntax-highlighter-line-number">20 | |
</span><span class="react-syntax-highlighter-line-number">21 | |
</span><span class="react-syntax-highlighter-line-number">22 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_5678"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"session.updated"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"session"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"sess_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.session"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"gpt-4o-realtime-preview"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"modalities"</span><span>: [</span><span class="hljs-string">"text"</span><span>], | |
</span></span><span><span> </span><span class="hljs-attr">"instructions"</span><span>: </span><span class="hljs-string">"New instructions"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"voice"</span><span>: </span><span class="hljs-string">"sage"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"output_audio_format"</span><span>: </span><span class="hljs-string">"pcm16"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"input_audio_transcription"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"model"</span><span>: </span><span class="hljs-string">"whisper-1"</span><span> | |
</span></span><span> }, | |
</span><span><span> </span><span class="hljs-attr">"turn_detection"</span><span>: </span><span class="hljs-literal">null</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"tools"</span><span>: [], | |
</span></span><span><span> </span><span class="hljs-attr">"tool_choice"</span><span>: </span><span class="hljs-string">"none"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"temperature"</span><span>: </span><span class="hljs-number">0.7</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"max_response_output_tokens"</span><span>: </span><span class="hljs-number">200</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation" class="anchor-heading" data-name="realtime-server-events/conversation"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/created" class="anchor-heading" data-name="realtime-server-events/conversation/created"><div class="flex flex-row items-center gap-3">conversation.created</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when a conversation is created. Emitted right after session creation.</p></div><div class="param-table" id="realtime-server-events/conversation/created__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/created-conversation" data-anchor="realtime-server-events/conversation/created-conversation" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">conversation</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The conversation resource.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/created-conversation_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/created-event_id" data-anchor="realtime-server-events/conversation/created-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/created-type" data-anchor="realtime-server-events/conversation/created-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.created</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.created</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_9101"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.created"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"conversation"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"conv_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.conversation"</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item" class="anchor-heading" data-name="realtime-server-events/conversation/item"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/created" class="anchor-heading" data-name="realtime-server-events/conversation/item/created"><div class="flex flex-row items-center gap-3">conversation.item.created</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when a conversation item is created. There are several scenarios that produce this event:</p> | |
<ul> | |
<li>The server is generating a Response, which if successful will produce | |
either one or two Items, which will be of type <code>message</code> | |
(role <code>assistant</code>) or type <code>function_call</code>.</li> | |
<li>The input audio buffer has been committed, either by the client or the | |
server (in <code>server_vad</code> mode). The server will take the content of the | |
input audio buffer and add it to a new user message Item.</li> | |
<li>The client has sent a <code>conversation.item.create</code> event to add a new Item | |
to the Conversation.</li> | |
</ul></div><div class="param-table" id="realtime-server-events/conversation/item/created__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/created-event_id" data-anchor="realtime-server-events/conversation/item/created-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/created-item" data-anchor="realtime-server-events/conversation/item/created-item" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The item to add to the conversation.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/item/created-item_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/created-previous_item_id" data-anchor="realtime-server-events/conversation/item/created-previous_item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">previous_item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the preceding item in the Conversation context, allows the | |
client to understand the order of the conversation.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/created-type" data-anchor="realtime-server-events/conversation/item/created-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.created</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.created</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_1920"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.created"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_item_id"</span><span>: </span><span class="hljs-string">"msg_002"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.item"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [] | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/retrieved" class="anchor-heading" data-name="realtime-server-events/conversation/item/retrieved"><div class="flex flex-row items-center gap-3">conversation.item.retrieved</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when a conversation item is retrieved with <code>conversation.item.retrieve</code>.</p></div><div class="param-table" id="realtime-server-events/conversation/item/retrieved__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/retrieved-event_id" data-anchor="realtime-server-events/conversation/item/retrieved-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/retrieved-item" data-anchor="realtime-server-events/conversation/item/retrieved-item" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The item to add to the conversation.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/item/retrieved-item_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/retrieved-type" data-anchor="realtime-server-events/conversation/item/retrieved-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.retrieved</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.retrieved</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span><span class="react-syntax-highlighter-line-number">13 | |
</span><span class="react-syntax-highlighter-line-number">14 | |
</span><span class="react-syntax-highlighter-line-number">15 | |
</span><span class="react-syntax-highlighter-line-number">16 | |
</span><span class="react-syntax-highlighter-line-number">17 | |
</span><span class="react-syntax-highlighter-line-number">18 | |
</span><span class="react-syntax-highlighter-line-number">19 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_1920"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.created"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_item_id"</span><span>: </span><span class="hljs-string">"msg_002"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"object"</span><span>: </span><span class="hljs-string">"realtime.item"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"message"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"status"</span><span>: </span><span class="hljs-string">"completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"role"</span><span>: </span><span class="hljs-string">"user"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content"</span><span>: [ | |
</span></span><span> { | |
</span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_audio"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"transcript"</span><span>: </span><span class="hljs-string">"hello how are you"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio"</span><span>: </span><span class="hljs-string">"base64encodedaudio=="</span><span> | |
</span></span><span> } | |
</span><span> ] | |
</span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/input_audio_transcription" class="anchor-heading" data-name="realtime-server-events/conversation/item/input_audio_transcription"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/input_audio_transcription/completed" class="anchor-heading" data-name="realtime-server-events/conversation/item/input_audio_transcription/completed"><div class="flex flex-row items-center gap-3">conversation.item.input_audio_transcription.completed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>This event is the output of audio transcription for user audio written to the | |
user audio buffer. Transcription begins when the input audio buffer is | |
committed by the client or server (in <code>server_vad</code> mode). Transcription runs | |
asynchronously with Response creation, so this event may come before or after | |
the Response events.</p> | |
<p>Realtime API models accept audio natively, and thus input transcription is a | |
separate process run on a separate ASR (Automatic Speech Recognition) model, | |
currently always <code>whisper-1</code>. Thus the transcript may diverge somewhat from | |
the model's interpretation, and should be treated as a rough guide.</p></div><div class="param-table" id="realtime-server-events/conversation/item/input_audio_transcription/completed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-content_index" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part containing the audio.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-event_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-item_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the user message item containing the audio.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-logprobs" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-logprobs" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">logprobs</div><div class="param-type"><div class="docs-markdown-content"><p>array or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The log probabilities of the transcription.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/item/input_audio_transcription/completed-logprobs_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-transcript" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-transcript" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">transcript</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The transcribed text.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/completed-type" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/completed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be | |
<code>conversation.item.input_audio_transcription.completed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.input_audio_transcription.completed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_2122"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.input_audio_transcription.completed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"transcript"</span><span>: </span><span class="hljs-string">"Hello, how are you?"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/input_audio_transcription/delta" class="anchor-heading" data-name="realtime-server-events/conversation/item/input_audio_transcription/delta"><div class="flex flex-row items-center gap-3">conversation.item.input_audio_transcription.delta</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when the text value of an input audio transcription content part is updated.</p></div><div class="param-table" id="realtime-server-events/conversation/item/input_audio_transcription/delta__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-content_index" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part in the item's content array.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-delta" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-delta" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">delta</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The text delta.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-event_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-item_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the item.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-logprobs" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-logprobs" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">logprobs</div><div class="param-type"><div class="docs-markdown-content"><p>array or null</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The log probabilities of the transcription.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/item/input_audio_transcription/delta-logprobs_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/delta-type" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/delta-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.input_audio_transcription.delta</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.input_audio_transcription.delta</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.input_audio_transcription.delta"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"item_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"delta"</span><span>: </span><span class="hljs-string">"Hello"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/input_audio_transcription/failed" class="anchor-heading" data-name="realtime-server-events/conversation/item/input_audio_transcription/failed"><div class="flex flex-row items-center gap-3">conversation.item.input_audio_transcription.failed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when input audio transcription is configured, and a transcription | |
request for a user message failed. These events are separate from other | |
<code>error</code> events so that the client can identify the related Item.</p></div><div class="param-table" id="realtime-server-events/conversation/item/input_audio_transcription/failed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/failed-content_index" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/failed-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part containing the audio.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/failed-error" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/failed-error" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">error</div><div class="param-type"><div class="docs-markdown-content"><p>object</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>Details of the transcription error.</p></div></div><button class="param-expand-button link-style" aria-expanded="false" aria-controls="realtime-server-events/conversation/item/input_audio_transcription/failed-error_table"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg><span>Show properties</span></button></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/failed-event_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/failed-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/failed-item_id" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/failed-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the user message item.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/input_audio_transcription/failed-type" data-anchor="realtime-server-events/conversation/item/input_audio_transcription/failed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be | |
<code>conversation.item.input_audio_transcription.failed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.input_audio_transcription.failed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span><span class="react-syntax-highlighter-line-number">8 | |
</span><span class="react-syntax-highlighter-line-number">9 | |
</span><span class="react-syntax-highlighter-line-number">10 | |
</span><span class="react-syntax-highlighter-line-number">11 | |
</span><span class="react-syntax-highlighter-line-number">12 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_2324"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.input_audio_transcription.failed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_003"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"error"</span><span>: { | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"transcription_error"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"code"</span><span>: </span><span class="hljs-string">"audio_unintelligible"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"message"</span><span>: </span><span class="hljs-string">"The audio could not be transcribed."</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"param"</span><span>: </span><span class="hljs-literal">null</span><span> | |
</span></span><span> } | |
</span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/truncated" class="anchor-heading" data-name="realtime-server-events/conversation/item/truncated"><div class="flex flex-row items-center gap-3">conversation.item.truncated</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when an earlier assistant audio message item is truncated by the | |
client with a <code>conversation.item.truncate</code> event. This event is used to | |
synchronize the server's understanding of the audio with the client's playback.</p> | |
<p>This action will truncate the audio and remove the server-side text transcript | |
to ensure there is no text in the context that hasn't been heard by the user.</p></div><div class="param-table" id="realtime-server-events/conversation/item/truncated__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/truncated-audio_end_ms" data-anchor="realtime-server-events/conversation/item/truncated-audio_end_ms" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">audio_end_ms</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The duration up to which the audio was truncated, in milliseconds.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/truncated-content_index" data-anchor="realtime-server-events/conversation/item/truncated-content_index" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">content_index</div><div class="param-type"><div class="docs-markdown-content"><p>integer</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The index of the content part that was truncated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/truncated-event_id" data-anchor="realtime-server-events/conversation/item/truncated-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/truncated-item_id" data-anchor="realtime-server-events/conversation/item/truncated-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the assistant message item that was truncated.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/truncated-type" data-anchor="realtime-server-events/conversation/item/truncated-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.truncated</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.truncated</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span><span class="react-syntax-highlighter-line-number">7 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_2526"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.truncated"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_004"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"content_index"</span><span>: </span><span class="hljs-number">0</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"audio_end_ms"</span><span>: </span><span class="hljs-number">1500</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/conversation/item/deleted" class="anchor-heading" data-name="realtime-server-events/conversation/item/deleted"><div class="flex flex-row items-center gap-3">conversation.item.deleted</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when an item in the conversation is deleted by the client with a | |
<code>conversation.item.delete</code> event. This event is used to synchronize the | |
server's understanding of the conversation history with the client's view.</p></div><div class="param-table" id="realtime-server-events/conversation/item/deleted__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/deleted-event_id" data-anchor="realtime-server-events/conversation/item/deleted-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/deleted-item_id" data-anchor="realtime-server-events/conversation/item/deleted-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the item that was deleted.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/conversation/item/deleted-type" data-anchor="realtime-server-events/conversation/item/deleted-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>conversation.item.deleted</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT conversation.item.deleted</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_2728"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"conversation.item.deleted"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_005"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/input_audio_buffer" class="anchor-heading" data-name="realtime-server-events/input_audio_buffer"><div></div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/input_audio_buffer/committed" class="anchor-heading" data-name="realtime-server-events/input_audio_buffer/committed"><div class="flex flex-row items-center gap-3">input_audio_buffer.committed</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when an input audio buffer is committed, either by the client or | |
automatically in server VAD mode. The <code>item_id</code> property is the ID of the user | |
message item that will be created, thus a <code>conversation.item.created</code> event | |
will also be sent to the client.</p></div><div class="param-table" id="realtime-server-events/input_audio_buffer/committed__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/committed-event_id" data-anchor="realtime-server-events/input_audio_buffer/committed-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/committed-item_id" data-anchor="realtime-server-events/input_audio_buffer/committed-item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the user message item that will be created.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/committed-previous_item_id" data-anchor="realtime-server-events/input_audio_buffer/committed-previous_item_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">previous_item_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The ID of the preceding item after which the new item will be inserted.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/committed-type" data-anchor="realtime-server-events/input_audio_buffer/committed-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>input_audio_buffer.committed</code>.</p></div></div></div></div><div class="param-table"></div></div><div class="section-right"><div class="section-right-inner"><div class="code-sample light-mode"><div class="code-sample-header"><div class="code-sample-title body-small">OBJECT input_audio_buffer.committed</div><button type="button" class="Wmjjd Ry4P0" data-color="secondary" data-variant="bare" data-size="sm" data-gutter-size="xs" data-icon-size="sm"><span class="_6jr41"><span class="eRdFc" data-align="start"><span class="block beN8R"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2V5Zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v2ZM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1H5Z" clip-rule="evenodd"></path></svg></span></span></span></button></div><div class="code-sample-body code-sample-body-small code-sample-body-with-header"><pre class="hljs syntax-highlighter light-mode code-sample-pre"><code class="language-JSON" style="white-space: pre;"><code style="float: left; padding-right: 10px;"><span class="react-syntax-highlighter-line-number">1 | |
</span><span class="react-syntax-highlighter-line-number">2 | |
</span><span class="react-syntax-highlighter-line-number">3 | |
</span><span class="react-syntax-highlighter-line-number">4 | |
</span><span class="react-syntax-highlighter-line-number">5 | |
</span><span class="react-syntax-highlighter-line-number">6 | |
</span></code><span><span>{ | |
</span></span><span><span> </span><span class="hljs-attr">"event_id"</span><span>: </span><span class="hljs-string">"event_1121"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"type"</span><span>: </span><span class="hljs-string">"input_audio_buffer.committed"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"previous_item_id"</span><span>: </span><span class="hljs-string">"msg_001"</span><span>, | |
</span></span><span><span> </span><span class="hljs-attr">"item_id"</span><span>: </span><span class="hljs-string">"msg_002"</span><span> | |
</span></span><span>}</span></code></pre></div></div></div></div></div></div><div class="section"><div class="anchor-heading-wrapper"><h2 id="realtime-server-events/input_audio_buffer/cleared" class="anchor-heading" data-name="realtime-server-events/input_audio_buffer/cleared"><div class="flex flex-row items-center gap-3">input_audio_buffer.cleared</div><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 24 24" class="anchor-heading-icon" role="presentation"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></h2></div><div class="endpoint"><div class="section-left"><div class="docs-markdown-content"><p>Returned when the input audio buffer is cleared by the client with a | |
<code>input_audio_buffer.clear</code> event.</p></div><div class="param-table" id="realtime-server-events/input_audio_buffer/cleared__table"><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/cleared-event_id" data-anchor="realtime-server-events/input_audio_buffer/cleared-event_id" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">event_id</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The unique ID of the server event.</p></div></div></div><div class="param-row"><div class="param-row-header api-ref-anchor-link-hover"><a href="#realtime-server-events/input_audio_buffer/cleared-type" data-anchor="realtime-server-events/input_audio_buffer/cleared-type" class="api-ref-anchor-link"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M18.293 5.707a4.657 4.657 0 0 0-6.586 0l-1 1a1 1 0 1 1-1.414-1.414l1-1a6.657 6.657 0 1 1 9.414 9.414l-1 1a1 1 0 0 1-1.414-1.414l1-1a4.657 4.657 0 0 0 0-6.586Zm-2.586 2.586a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414l6-6a1 1 0 0 1 1.414 0Zm-9 1a1 1 0 0 1 0 1.414l-1 1a4.657 4.657 0 0 0 6.586 6.586l1-1a1 1 0 0 1 1.414 1.414l-1 1a6.657 6.657 0 1 1-9.414-9.414l1-1a1 1 0 0 1 1.414 0Z" clip-rule="evenodd"></path></svg></a><div class="param-name">type</div><div class="param-type"><div class="docs-markdown-content"><p>string</p></div></div></div><div class="param-desc"><div class="docs-markdown-content"><p>The event type, must be <code>input_audio_buffer.cleared</code>.</p></div></div></div></div><div class="par |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment