<!DOCTYPE html><html lang="en" data-theme="light" data-site-variant-visibility-initialized="true" style="--docs-agent-context-subnav-offset: 0px;"><head><!-- Global Metadata --><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><script data-astro-exec="">(function(){const siteVariantDomains = [{"id":"chatgpt-docs","domains":["learn.chatgpt.com","learn.chatgpt-staging.com","learn-chatgpt-preview.localhost"]}];
const forcedSiteVariantId = undefined;
const siteVariantQueryParam = "site_variant";
const chatGptSiteVariant = "chatgpt";
const chatGptDocsVariantId = "chatgpt-docs";
const developersOpenAiHostname = "developers.openai.com";

  (() => {
    const hostname = window.location.hostname.toLowerCase().replace(/\.$/, "");
    const queryVariant =
      hostname !== developersOpenAiHostname &&
      new URLSearchParams(window.location.search).get(siteVariantQueryParam) ===
        chatGptSiteVariant
        ? chatGptDocsVariantId
        : undefined;
    const hostnameVariant = siteVariantDomains.find((variant) =>
      variant.domains.some(
        (domain) => domain.toLowerCase().replace(/\.$/, "") === hostname
      )
    )?.id;
    const activeVariantId =
      forcedSiteVariantId || hostnameVariant || queryVariant;

    if (forcedSiteVariantId) {
      document.documentElement.dataset.siteVariantForced = forcedSiteVariantId;
    } else {
      delete document.documentElement.dataset.siteVariantForced;
    }

    if (activeVariantId) {
      document.documentElement.dataset.siteVariant = activeVariantId;
    } else {
      delete document.documentElement.dataset.siteVariant;
    }
  })();
})();</script><link rel="icon" type="image/png" href="/favicon.png"><meta name="generator" content="Astro v6.0.4"><link rel="preload" href="/fonts/OpenAISans-Regular.woff" as="font" type="font/woff" crossorigin=""><link rel="preload" href="/fonts/OpenAISans-Bold.woff" as="font" type="font/woff" crossorigin=""><style>
  @layer theme, base, components, utilities;
</style><!-- Canonical URL --><link rel="canonical" href="https://developers.openai.com/api/docs/quickstart"><!-- Primary Meta Tags --><title data-default-meta-title="Developer quickstart | OpenAI API">Developer quickstart | OpenAI API</title><meta name="title" content="Developer quickstart | OpenAI API"><meta name="description" content="Learn how to use the OpenAI API to generate human-like responses to natural language prompts, analyze images with computer vision, use powerful built-in tools, and more."><!-- Open Graph / Facebook --><meta property="og:type" content="website"><meta property="og:url" content="https://developers.openai.com/api/docs/quickstart"><meta property="og:site_name" content="OpenAI Developers"><meta property="og:title" content="Developer quickstart | OpenAI API"><meta property="og:description" content="Learn how to use the OpenAI API to generate human-like responses to natural language prompts, analyze images with computer vision, use powerful built-in tools, and more."><meta property="og:image" content="https://developers.openai.com/og/api/docs/quickstart.png"><meta property="og:image:alt" content="Developer quickstart | OpenAI API"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><!-- Twitter --><meta name="twitter:card" content="summary_large_image"><meta name="twitter:site" content="@OpenAIDevs"><meta name="twitter:url" content="https://developers.openai.com/api/docs/quickstart"><meta name="twitter:title" content="Developer quickstart | OpenAI API"><meta name="twitter:description" content="Learn how to use the OpenAI API to generate human-like responses to natural language prompts, analyze images with computer vision, use powerful built-in tools, and more."><meta name="twitter:image" content="https://developers.openai.com/og/api/docs/quickstart.png"><meta name="twitter:image:width" content="1200"><meta name="twitter:image:height" content="630"><meta name="twitter:image:alt" content="Developer quickstart | OpenAI API"><!-- Sitemap --><link rel="sitemap" href="/sitemap-index.xml"><!-- RSS Feed --><link rel="alternate" type="application/rss+xml" title="Developer quickstart | OpenAI API" data-page-meta-title="" href="https://developers.openai.com/rss.xml"><!-- Global Scripts --><script src="/js/theme.js" data-astro-exec=""></script><script src="/js/scroll.js" data-astro-exec=""></script><script src="/js/animate.js" data-astro-exec=""></script><script defer="" src="/js/copy.js" data-astro-exec=""></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="swap"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.DzgQ-PwA.js" data-astro-exec=""></script><link rel="stylesheet" href="/_astro/platform-docs.C8tKlvDz.css">
<link rel="stylesheet" href="/_astro/PageLayout.D8pYrHWP.css">
<style>.prompt-scroll:where(.astro-blfj6jyd){--prompt-scroll-gutter-x: 14px;--prompt-scroll-gutter-y: 16px;padding:0 calc(4.5rem + var(--prompt-scroll-gutter-x)) 0 1.5rem;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:rgb(15 23 42 / 28%) transparent}.prompt-scroll--header-actions:where(.astro-blfj6jyd){padding-right:1.5rem}.prompt-scroll-frame:where(.astro-blfj6jyd){position:relative;background:inherit}.prompt-scroll__content:where(.astro-blfj6jyd){margin-right:calc(-1 * var(--prompt-scroll-gutter-x))}.prompt-scroll--header-actions:where(.astro-blfj6jyd) .prompt-scroll__content:where(.astro-blfj6jyd){margin-right:0}.prompt-scroll-frame:where(.astro-blfj6jyd):before,.prompt-scroll-frame:where(.astro-blfj6jyd):after{content:"";position:absolute;right:0;width:calc(1.5rem + var(--prompt-scroll-gutter-x) + 8px);height:var(--prompt-scroll-gutter-y);background:inherit;pointer-events:none;z-index:1}.prompt-scroll-frame:where(.astro-blfj6jyd):before{top:0}.prompt-scroll-frame:where(.astro-blfj6jyd):after{bottom:0}.prompt-actions:where(.astro-blfj6jyd){z-index:2}.prompt-scroll:where(.astro-blfj6jyd)::-webkit-scrollbar{width:8px;height:8px}.prompt-scroll:where(.astro-blfj6jyd)::-webkit-scrollbar-track{background:transparent;margin-block:var(--prompt-scroll-gutter-y)}.prompt-scroll:where(.astro-blfj6jyd)::-webkit-scrollbar-thumb{background-color:#0f172a47;border:2px solid transparent;border-radius:9999px;background-clip:padding-box}html.dark .prompt-scroll:where(.astro-blfj6jyd),[data-theme=dark] .prompt-scroll:where(.astro-blfj6jyd){scrollbar-color:rgb(255 255 255 / 28%) transparent}html.dark .prompt-scroll:where(.astro-blfj6jyd)::-webkit-scrollbar-thumb,[data-theme=dark] .prompt-scroll:where(.astro-blfj6jyd)::-webkit-scrollbar-thumb{background-color:#ffffff47}
.page-copy-action:where(.astro-y3m22efp){display:inline-flex;min-height:26px;align-items:center;justify-content:center;gap:6px;border:1px solid var(--border-primary-outline, rgb(209 213 219));border-radius:8px;background:var(--surface-primary, #fff);padding:5px 10px;color:var(--text-primary, #202123);font-size:12px;font-weight:500;line-height:1;white-space:nowrap;transition:border-color .12s ease,background-color .12s ease,color .12s ease,opacity .12s ease}.page-copy-action:where(.astro-y3m22efp):hover:not(:disabled){background:var(--surface-primary-hover, #f7f7f8)}.page-copy-action:where(.astro-y3m22efp):focus-visible{outline:2px solid var(--border-primary, #111);outline-offset:2px}.page-copy-action:where(.astro-y3m22efp):disabled{cursor:progress;opacity:.7}.page-copy-action--cta:where(.astro-y3m22efp){min-height:42px;gap:8px;border-radius:9999px;padding:10px 18px;font-size:14px}.page-copy-action__icon:where(.astro-y3m22efp){display:inline-flex;width:14px;height:14px;align-items:center;justify-content:center}.page-copy-action__icon:where(.astro-y3m22efp) svg{width:14px;height:14px}.page-copy-action__icon--check:where(.astro-y3m22efp),.page-copy-action:where(.astro-y3m22efp)[data-copied=true] .page-copy-action__icon--copy:where(.astro-y3m22efp){display:none}.page-copy-action:where(.astro-y3m22efp)[data-copied=true] .page-copy-action__icon--check:where(.astro-y3m22efp){display:inline-flex}
</style>
<link rel="stylesheet" href="/_astro/AgentDocsDirective.DEiRrpNI.css">
<style>@layer components{._Arrow_t2o77_1{--arrow-size: 6px;position:absolute;width:0;height:0}._Arrow_t2o77_1[data-side=top]{bottom:0;left:50%;border-top:var(--arrow-size) solid var(--gray-700);border-right:var(--arrow-size) solid transparent;border-left:var(--arrow-size) solid transparent;margin-right:-8px;transform:translate(-50%) translateY(100%)}._Arrow_t2o77_1[data-side=bottom]{top:0;left:50%;border-right:var(--arrow-size) solid transparent;border-bottom:var(--arrow-size) solid var(--gray-700);border-left:var(--arrow-size) solid transparent;margin-left:-8px;transform:translate(-50%) translateY(-100%)}._Arrow_t2o77_1[data-side=left]{top:50%;right:0;border-top:var(--arrow-size) solid transparent;border-bottom:var(--arrow-size) solid transparent;border-left:var(--arrow-size) solid var(--gray-700);margin-right:-8px;transform:translate(100%) translateY(-50%)}._Arrow_t2o77_1[data-side=right]{top:50%;left:0;border-top:var(--arrow-size) solid transparent;border-right:var(--arrow-size) solid var(--gray-700);border-bottom:var(--arrow-size) solid transparent;margin-left:-8px;transform:translate(-100%) translateY(-50%)}}@layer components{._surfaceOption_spfw2_1>div>div>div:first-child{display:none}._surfaceOption_spfw2_1>div>div{align-items:center}[data-radix-popper-content-wrapper]:has(.codex-surface-option){z-index:40!important}[role=listbox]:has(.codex-surface-option){outline:none}}
</style><script type="module" src="/_astro/page.BLsl0KIt.js" data-astro-exec=""></script><style>@layer components{._TransitionItem_1lpir_1{will-change:var(--tg-will-change)}[data-transition-position=absolute] ._TransitionItem_1lpir_1[data-exiting],[data-transition-position=absolute] ._TransitionItem_1lpir_1:not([data-exiting])+._TransitionItem_1lpir_1[data-entering]{position:absolute;top:0;left:0;width:100%}._TransitionItem_1lpir_1[data-entering]{filter:var(--tg-initial-filter);opacity:var(--tg-initial-opacity);transform:var(--tg-initial-transform)}._TransitionItem_1lpir_1[data-exiting]{filter:var(--tg-enter-filter);opacity:var(--tg-enter-opacity);transform:var(--tg-enter-transform)}._TransitionItem_1lpir_1[data-entering-active],._TransitionItem_1lpir_1[data-entering][data-interrupted]{filter:var(--tg-enter-filter);opacity:var(--tg-enter-opacity);transform:var(--tg-enter-transform);transition:opacity var(--tg-enter-duration) var(--tg-enter-timing-function) var(--tg-enter-delay),transform var(--tg-enter-duration) var(--tg-enter-timing-function) var(--tg-enter-delay),filter var(--tg-enter-duration) var(--tg-enter-timing-function) var(--tg-enter-delay)}._TransitionItem_1lpir_1[data-exiting-active],._TransitionItem_1lpir_1[data-exiting][data-interrupted]{filter:var(--tg-exit-filter, none);opacity:var(--tg-exit-opacity, 0);transform:var(--tg-exit-transform, none);transition:opacity var(--tg-exit-duration) var(--tg-exit-timing-function) var(--tg-exit-delay),transform var(--tg-exit-duration) var(--tg-exit-timing-function) var(--tg-exit-delay),filter var(--tg-exit-duration) var(--tg-exit-timing-function) var(--tg-exit-delay)}._TransitionItem_1lpir_1[data-entering][data-interrupted],._TransitionItem_1lpir_1[data-exiting][data-interrupted]{transition-delay:0ms}}
</style><style>@layer components{._TextLink_ssta1_1{display:inline-flex;align-items:center;gap:var(--link-gap);border-radius:var(--link-radius);color:currentcolor;cursor:pointer;font-weight:var(--link-font-weight);overflow-wrap:anywhere;transition-duration:var(--transition-duration-basic);transition-property:opacity,color,box-shadow,text-decoration-color;transition-timing-function:var(--transition-ease-basic)}@media(hover:hover)and (pointer:fine){._TextLink_ssta1_1:hover{color:color-mix(in oklab,currentcolor 80%,transparent)}.text-secondary ._TextLink_ssta1_1:hover{color:var(--color-text)}.text-tertiary ._TextLink_ssta1_1:hover{color:var(--color-text-secondary)}}._TextLink_ssta1_1:focus-visible{outline:2px solid var(--color-ring);outline-offset:1px}._TextLink_ssta1_1[data-underline=always]{text-decoration:underline;text-decoration-color:color-mix(in oklab,currentcolor 70%,transparent);text-underline-offset:var(--link-underline-decoration-offset)}@media(hover:hover)and (pointer:fine){._TextLink_ssta1_1[data-underline=hover]:hover{text-decoration:underline;text-decoration-color:color-mix(in oklab,currentcolor 70%,transparent);text-underline-offset:var(--link-underline-decoration-offset)}}._TextLink_ssta1_1[data-primary]{color:var(--link-primary-text-color)}@media(hover:hover)and (pointer:fine){._TextLink_ssta1_1[data-primary]:hover{color:var(--link-primary-text-color-hover)}}}
</style><style>.content-switcher-selector:where(.astro-cr4aci74){width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;touch-action:pan-x}.content-switcher-selector-right:where(.astro-cr4aci74){text-align:right}
</style><style>@layer base{.syntax-highlighter{background:transparent;color:var(--color-text);overflow-x:auto}.syntax-highlighter>code{border:none;box-shadow:none;font-family:var(--monospace)}.syntax-highlighter>code[data-wrap-long-lines=true]{overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-word}.syntax-highlighter .syntax-highlighter-line-numbers{float:left;padding-right:16px}.syntax-highlighter .syntax-highlighter-line-number{color:var(--color-text-disabled);line-height:20px;opacity:.5;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.syntax-highlighter .shiki-token{color:var(--shiki-light, inherit)}.syntax-highlighter [data-highlighted-row=true]{display:block;width:150%;margin-left:-25%;background-color:var(--pill-success-bg)}.syntax-highlighter [data-highlighted-row-subtle=true]{background-color:rgba(var(--sh-fg),.08)}.dark .syntax-highlighter .shiki-token,.syntax-highlighter.dark-mode .shiki-token{color:var(--shiki-dark, var(--shiki-light, inherit))}}@layer components.base{._root_1x2h7_2{position:relative;display:flex;flex-direction:column;margin:20px 0;border:.5px solid var(--color-border-primary-surface);border-radius:8px;background:var(--code-snippet-bg)}._root_1x2h7_2+._root_1x2h7_2{margin-top:1em}._flush_1x2h7_16{width:100%;border:0;background:transparent;background-color:transparent;color:var(--color-text-emphasis);line-height:20px}._flush_1x2h7_16 code>code{padding-right:20px!important}._flush_1x2h7_16 .syntax-highlighter{background:transparent;font-size:13px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._header_1x2h7_34{position:relative;z-index:1;justify-content:space-between;padding-left:8px;border-bottom:none;background:transparent}._flush_1x2h7_16 ._header_1x2h7_34 ._title_1x2h7_42{display:none}._flush_1x2h7_16 ._header_1x2h7_34 .code-sample-select-val{font-size:12px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._header_1x2h7_34 .code-sample-select-wrap{margin-bottom:4px;margin-left:12px;font-size:12px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._body_1x2h7_59{background:transparent}._flush_1x2h7_16 ._body_1x2h7_59 ._pre_1x2h7_62{padding-top:0}._root_1x2h7_2 .python-upgrade-banner{display:flex;padding:2px;background:var(--card-gradient);color:#fff;font-size:.8em;font-weight:var(--font-weight-bold);text-align:center}._root_1x2h7_2 .python-upgrade-banner svg{margin-top:6px;margin-right:8px;margin-left:8px}._root_1x2h7_2 .python-upgrade-banner path{stroke:#fff}._header_1x2h7_34{overflow:auto;display:flex;align-items:center;gap:4px;flex-shrink:0;padding:4px 8px 4px 14px;border-bottom:.5px solid var(--color-border-primary-surface);border-top-left-radius:8px;border-top-right-radius:8px}._title_1x2h7_42{overflow:hidden;flex:1 1 auto;margin-right:12px;color:var(--color-text);font-family:var(--monospace);font-size:12px;font-weight:var(--font-weight-normal);letter-spacing:var(--font-tracking-wide);text-overflow:ellipsis;white-space:nowrap}._sep_1x2h7_113{flex:0 0 auto;min-width:1px;height:22px;padding-left:8px;border-left:1px solid var(--color-background-primary-soft);margin-left:8px}._body_1x2h7_59{position:relative;flex-grow:1;flex-shrink:0}._body_1x2h7_59 ._pre_1x2h7_62{height:100%;min-height:44px;padding:12px 16px;border-radius:8px;margin:0;font-size:14px;line-height:20px;white-space:pre;background:var(--code-snippet-bg)}._body_1x2h7_59._bodyWithHeader_1x2h7_139 ._pre_1x2h7_62{border-top-left-radius:0;border-top-right-radius:0}._bodyWithCopyFloat_1x2h7_145 ._pre_1x2h7_62{padding-right:56px}._copyFloat_1x2h7_157{position:absolute;top:6px;right:6px}._oneliner_1x2h7_162 ._copyFloat_1x2h7_157{top:50%;transform:translateY(-50%)}._copyButton_1x2h7_168{height:1.75rem;padding:0 .5rem;border-radius:.375rem}}
</style><style>@layer components{._Tooltip_purug_1{max-width:300px;border-radius:var(--tooltip-border-radius);animation-duration:.25s;animation-name:_scale-in_purug_1;animation-timing-function:var(--cubic-enter);background:var(--tooltip-background-color);box-shadow:var(--tooltip-box-shadow);color:var(--tooltip-text-color);font-size:var(--tooltip-font-size);font-weight:var(--tooltip-font-weight);line-height:var(--tooltip-line-height);transform-origin:var(--radix-tooltip-content-transform-origin);transition:background-color .15s ease}._Tooltip_purug_1[data-state=closed]{animation:_scale-out_purug_1 .25s var(--cubic-enter)}._Tooltip_purug_1[data-clickable=false]{cursor:default}._Tooltip_purug_1[data-clickable=true]{cursor:pointer}@media(hover:hover)and (pointer:fine){._Tooltip_purug_1[data-compact=true][data-clickable=true]:hover{background:var(--tooltip-compact-interactive-background-color-hover);color:var(--tooltip-compact-interactive-text-color-hover)}}._Tooltip_purug_1[data-gutter-size=sm]{padding:var(--tooltip-padding-sm)}._Tooltip_purug_1[data-gutter-size=md]{padding:var(--tooltip-padding-md)}._Tooltip_purug_1[data-gutter-size=lg]{padding:var(--tooltip-padding-lg)}._Tooltip_purug_1[data-compact=true]{padding:var(--tooltip-compact-padding);background:var(--tooltip-compact-background-color);color:var(--tooltip-compact-text-color);font-size:var(--tooltip-compact-font-size);font-weight:var(--tooltip-compact-font-weight)}@keyframes _scale-in_purug_1{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes _scale-out_purug_1{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.97)}}._TriggerDecorator_purug_84{display:inline-flex;cursor:pointer;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;text-decoration-color:transparent;transition:-webkit-text-decoration .2s var(--cubic-exit);transition:text-decoration .2s var(--cubic-exit);transition:text-decoration .2s var(--cubic-exit),-webkit-text-decoration .2s var(--cubic-exit)}._TriggerDecorator_purug_84:focus{outline:0}._TriggerDecorator_purug_84[data-state*=open]{text-decoration-color:var(--color-text-tertiary);transition-timing-function:var(--cubic-enter)}}
</style><style>@layer base{.syntax-highlighter{background:transparent;color:var(--color-text);overflow-x:auto}.syntax-highlighter>code{border:none;box-shadow:none;font-family:var(--monospace)}.syntax-highlighter>code[data-wrap-long-lines=true]{overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-word}.syntax-highlighter .syntax-highlighter-line-numbers{float:left;padding-right:16px}.syntax-highlighter .syntax-highlighter-line-number{color:var(--color-text-disabled);line-height:20px;opacity:.5;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.syntax-highlighter .shiki-token{color:var(--shiki-light, inherit)}.syntax-highlighter [data-highlighted-row=true]{display:block;width:150%;margin-left:-25%;background-color:var(--pill-success-bg)}.syntax-highlighter [data-highlighted-row-subtle=true]{background-color:rgba(var(--sh-fg),.08)}.dark .syntax-highlighter .shiki-token,.syntax-highlighter.dark-mode .shiki-token{color:var(--shiki-dark, var(--shiki-light, inherit))}}
</style><style>@layer components.base{._root_1x2h7_2{position:relative;display:flex;flex-direction:column;margin:20px 0;border:.5px solid var(--color-border-primary-surface);border-radius:8px;background:var(--code-snippet-bg)}._root_1x2h7_2+._root_1x2h7_2{margin-top:1em}._flush_1x2h7_16{width:100%;border:0;background:transparent;background-color:transparent;color:var(--color-text-emphasis);line-height:20px}._flush_1x2h7_16 code>code{padding-right:20px!important}._flush_1x2h7_16 .syntax-highlighter{background:transparent;font-size:13px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._header_1x2h7_34{position:relative;z-index:1;justify-content:space-between;padding-left:8px;border-bottom:none;background:transparent}._flush_1x2h7_16 ._header_1x2h7_34 ._title_1x2h7_42{display:none}._flush_1x2h7_16 ._header_1x2h7_34 .code-sample-select-val{font-size:12px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._header_1x2h7_34 .code-sample-select-wrap{margin-bottom:4px;margin-left:12px;font-size:12px;letter-spacing:var(--font-tracking-wide)}._flush_1x2h7_16 ._body_1x2h7_59{background:transparent}._flush_1x2h7_16 ._body_1x2h7_59 ._pre_1x2h7_62{padding-top:0}._root_1x2h7_2 .python-upgrade-banner{display:flex;padding:2px;background:var(--card-gradient);color:#fff;font-size:.8em;font-weight:var(--font-weight-bold);text-align:center}._root_1x2h7_2 .python-upgrade-banner svg{margin-top:6px;margin-right:8px;margin-left:8px}._root_1x2h7_2 .python-upgrade-banner path{stroke:#fff}._header_1x2h7_34{overflow:auto;display:flex;align-items:center;gap:4px;flex-shrink:0;padding:4px 8px 4px 14px;border-bottom:.5px solid var(--color-border-primary-surface);border-top-left-radius:8px;border-top-right-radius:8px}._title_1x2h7_42{overflow:hidden;flex:1 1 auto;margin-right:12px;color:var(--color-text);font-family:var(--monospace);font-size:12px;font-weight:var(--font-weight-normal);letter-spacing:var(--font-tracking-wide);text-overflow:ellipsis;white-space:nowrap}._sep_1x2h7_113{flex:0 0 auto;min-width:1px;height:22px;padding-left:8px;border-left:1px solid var(--color-background-primary-soft);margin-left:8px}._body_1x2h7_59{position:relative;flex-grow:1;flex-shrink:0}._body_1x2h7_59 ._pre_1x2h7_62{height:100%;min-height:44px;padding:12px 16px;border-radius:8px;margin:0;font-size:14px;line-height:20px;white-space:pre;background:var(--code-snippet-bg)}._body_1x2h7_59._bodyWithHeader_1x2h7_139 ._pre_1x2h7_62{border-top-left-radius:0;border-top-right-radius:0}._bodyWithCopyFloat_1x2h7_145 ._pre_1x2h7_62{padding-right:56px}._copyFloat_1x2h7_157{position:absolute;top:6px;right:6px}._oneliner_1x2h7_162 ._copyFloat_1x2h7_157{top:50%;transform:translateY(-50%)}._copyButton_1x2h7_168{height:1.75rem;padding:0 .5rem;border-radius:.375rem}}
</style><link rel="stylesheet" href="/_astro/SegmentedControl.BVdWyLBX.css"><link rel="stylesheet" href="/_astro/Select.ZFNnOywo.css"><link rel="stylesheet" href="/_astro/Button.Cu9_vjWu.css"><script src="/_vercel/speed-insights/script.js" defer="" data-sdkn="@vercel/speed-insights/astro" data-sdkv="1.3.1" data-route="/api/docs/[slug]/"></script><script src="/_vercel/insights/script.js" defer="" data-sdkn="@vercel/analytics" data-sdkv="1.6.1"></script></head> <body class="overflow-x-hidden" data-pagefind-filter="section:api" data-has-context-subnav="true"> <div class="agent-docs-directive astro-e454tk5z" data-agent-docs-directive="">
For the complete documentation index, see <a href="/llms.txt" tabindex="-1" class="astro-e454tk5z">llms.txt</a>. Markdown versions of documentation pages are available by appending
<code class="astro-e454tk5z">.md</code> to the page URL.
</div> <script type="module" src="/_astro/Header.astro_astro_type_script_index_0_lang.CZqP2L81.js" data-astro-exec=""></script> <header id="header" class="fixed top-0 w-full h-16 z-50 bg-white dark:bg-black border-b border-primary-surface astro-3ef6ksr2"> <div class="flex items-center h-full px-4 md:px-8 lg:grid lg:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] lg:gap-6 astro-3ef6ksr2"> <!-- Logo --> <a href="/" class="flex items-center font-semibold ml-0 lg:-ml-2 lg:justify-self-start astro-3ef6ksr2"> <img src="/OpenAI_Developers.svg" alt="OpenAI Developers" class="h-6 w-48 md:h-6 dark:invert astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> <span class="flex items-center text-default astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden="">  <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill="currentColor" viewBox="0 0 100 100" class="h-6 w-6 astro-3ef6ksr2 " aria-hidden="true"><path color="currentColor" d="M38.355 36.52v-9.415c0-.793.297-1.388.99-1.784l18.93-10.902c2.578-1.486 5.65-2.18 8.82-2.18 11.894 0 19.426 9.218 19.426 19.029 0 .694 0 1.486-.1 2.28L66.799 22.05c-1.189-.694-2.379-.694-3.568 0L38.355 36.52Zm44.202 36.67V50.694c0-1.388-.596-2.38-1.785-3.073L55.897 33.15l8.126-4.658c.694-.396 1.289-.396 1.982 0l18.93 10.902c5.452 3.172 9.118 9.91 9.118 16.452 0 7.531-4.46 14.47-11.496 17.344Zm-50.05-19.82-8.127-4.757c-.693-.396-.99-.99-.99-1.784V25.025c0-10.605 8.126-18.633 19.127-18.633 4.163 0 8.028 1.388 11.3 3.865l-19.525 11.3c-1.189.693-1.784 1.684-1.784 3.072v28.74ZM50 63.478l-11.645-6.541V43.062L50 36.522l11.645 6.54v13.875L50 63.477Zm7.483 30.129c-4.163 0-8.028-1.388-11.3-3.865l19.525-11.3c1.189-.693 1.784-1.684 1.784-3.071V46.629l8.226 4.757c.694.396.991.991.991 1.784v21.803c0 10.605-8.226 18.633-19.226 18.633v.001Zm-23.49-22.101-18.93-10.902c-5.45-3.172-9.117-9.91-9.117-16.451 0-7.632 4.559-14.47 11.595-17.344v22.596c0 1.388.595 2.379 1.784 3.072l24.777 14.37-8.126 4.659c-.694.396-1.289.396-1.982 0ZM32.905 87.76c-11.2 0-19.425-8.425-19.425-18.83 0-.794.1-1.587.198-2.38L33.2 77.85c1.189.693 2.379.693 3.568 0l24.876-14.37v9.415c0 .793-.298 1.388-.992 1.784L41.724 85.58c-2.576 1.486-5.649 2.18-8.82 2.18h.001Zm24.579 11.793c11.992 0 22.001-8.523 24.281-19.822C92.864 76.857 100 66.451 100 55.846c0-6.937-2.973-13.676-8.325-18.533.496-2.081.793-4.163.793-6.243 0-14.172-11.496-24.777-24.777-24.777-2.676 0-5.253.396-7.83 1.288C55.401 3.221 49.257.445 42.517.445c-11.992 0-22.001 8.523-24.281 19.822C7.136 23.14 0 33.547 0 44.152c0 6.938 2.973 13.676 8.325 18.533-.496 2.081-.793 4.163-.793 6.243 0 14.172 11.497 24.778 24.777 24.778 2.676 0 5.253-.397 7.83-1.289 4.459 4.36 10.604 7.136 17.344 7.136Z"></path></svg> <span class="sr-only astro-3ef6ksr2">ChatGPT</span>  </span> </a> <!-- Links --> <nav class="hidden lg:flex items-center justify-center gap-1 astro-3ef6ksr2"> <div class="relative group astro-3ef6ksr2"> <a href="/" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2"> Home  </a>  </div><div class="relative group astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> <a href="/api/docs" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-default bg-primary-soft astro-3ef6ksr2"> API  </a>  </div><div class="relative group astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> <a href="https://learn.chatgpt.com/docs" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2" aria-haspopup="menu"> Codex <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 text-tertiary astro-3ef6ksr2 "><path d="M11.2929 16.2929C11.6834 16.6834 12.3166 16.6834 12.7071 16.2929L18.7071 10.2929C19.0976 9.90237 19.0976 9.26921 18.7071 8.87868C18.3166 8.48816 17.6834 8.48816 17.2929 8.87868L12 14.1716L6.70711 8.87868C6.31658 8.48816 5.68342 8.48816 5.29289 8.87868C4.90237 9.26921 4.90237 9.90237 5.29289 10.2929L11.2929 16.2929Z" fill="currentColor"></path></svg> </a> <div class="invisible opacity-0 absolute left-0 top-full z-50 mt-2 min-w-full w-max transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100 before:content-[''] before:absolute before:-top-2 before:left-0 before:right-0 before:h-2 astro-3ef6ksr2" role="menu"> <div class="overflow-hidden rounded-md border border-primary-surface bg-surface shadow-md ring-1 ring-black/5 dark:ring-white/10 astro-3ef6ksr2"> <div class="astro-3ef6ksr2"> <a role="menuitem" href="https://learn.chatgpt.com/docs" target="_blank" rel="noopener noreferrer" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Docs</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Guides, concepts, and product docs for Codex </div> </div> </a><a role="menuitem" href="https://learn.chatgpt.com/use-cases" target="_blank" rel="noopener noreferrer" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Use cases</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Example workflows and tasks teams can take on with ChatGPT or Codex </div> </div> </a> </div> </div> </div> </div><div class="relative group astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> <a href="/codex" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2"> Docs  </a>  </div><div class="relative group astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> <a href="https://learn.chatgpt.com/use-cases" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2"> Use cases  </a>  </div><div class="relative group astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> <a href="/codex/resources" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2"> Resources  </a>  </div><div class="relative group astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> <a href="/chatgpt" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2" aria-haspopup="menu"> ChatGPT <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 text-tertiary astro-3ef6ksr2 "><path d="M11.2929 16.2929C11.6834 16.6834 12.3166 16.6834 12.7071 16.2929L18.7071 10.2929C19.0976 9.90237 19.0976 9.26921 18.7071 8.87868C18.3166 8.48816 17.6834 8.48816 17.2929 8.87868L12 14.1716L6.70711 8.87868C6.31658 8.48816 5.68342 8.48816 5.29289 8.87868C4.90237 9.26921 4.90237 9.90237 5.29289 10.2929L11.2929 16.2929Z" fill="currentColor"></path></svg> </a> <div class="invisible opacity-0 absolute left-0 top-full z-50 mt-2 min-w-full w-max transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100 before:content-[''] before:absolute before:-top-2 before:left-0 before:right-0 before:h-2 astro-3ef6ksr2" role="menu"> <div class="overflow-hidden rounded-md border border-primary-surface bg-surface shadow-md ring-1 ring-black/5 dark:ring-white/10 astro-3ef6ksr2"> <div class="astro-3ef6ksr2"> <a role="menuitem" href="/plugins" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Plugins</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Extend ChatGPT and Codex </div> </div> </a><a role="menuitem" href="/workspace-agents" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Workspace Agents</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Trigger published ChatGPT workspace agents </div> </div> </a><a role="menuitem" href="/commerce" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Commerce</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Build commerce flows in ChatGPT </div> </div> </a><a role="menuitem" href="/ads" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Ads</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Publish and measure ads in ChatGPT </div> </div> </a> </div> </div> </div> </div><div class="relative group astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> <a href="/learn" class="flex items-center gap-1 text-sm px-2.5 py-1 rounded-md text-primary-soft hover:text-default hover:bg-primary-soft-alpha astro-3ef6ksr2" aria-haspopup="menu"> Resources <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 text-tertiary astro-3ef6ksr2 "><path d="M11.2929 16.2929C11.6834 16.6834 12.3166 16.6834 12.7071 16.2929L18.7071 10.2929C19.0976 9.90237 19.0976 9.26921 18.7071 8.87868C18.3166 8.48816 17.6834 8.48816 17.2929 8.87868L12 14.1716L6.70711 8.87868C6.31658 8.48816 5.68342 8.48816 5.29289 8.87868C4.90237 9.26921 4.90237 9.90237 5.29289 10.2929L11.2929 16.2929Z" fill="currentColor"></path></svg> </a> <div class="invisible opacity-0 absolute left-0 top-full z-50 mt-2 min-w-full w-max transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100 before:content-[''] before:absolute before:-top-2 before:left-0 before:right-0 before:h-2 astro-3ef6ksr2" role="menu"> <div class="overflow-hidden rounded-md border border-primary-surface bg-surface shadow-md ring-1 ring-black/5 dark:ring-white/10 astro-3ef6ksr2"> <div class="astro-3ef6ksr2"> <a role="menuitem" href="/showcase" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Showcase</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Demo apps to get inspired </div> </div> </a><a role="menuitem" href="/blog" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Blog</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Learnings and experiences from developers </div> </div> </a><a role="menuitem" href="/cookbook" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Cookbook</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Notebook examples for building with OpenAI models </div> </div> </a><a role="menuitem" href="/learn" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Learn</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Docs, videos, and demo apps for building with OpenAI </div> </div> </a><a role="menuitem" href="/community" class="block px-4 py-3 text-sm text-default transition-colors hover:bg-primary-soft-alpha dark:hover:bg-alpha-10 hover:text-default astro-3ef6ksr2"> <div class="flex flex-col gap-1 astro-3ef6ksr2"> <div class="font-medium astro-3ef6ksr2">Community</div> <div class="text-sm text-secondary astro-3ef6ksr2"> Programs, meetups, and support for builders </div> </div> </a> </div> </div> </div> </div>  </nav> <!-- Theme Toggle, Mobile Menu --> <div class="ml-auto flex items-center gap-4 lg:gap-5 lg:ml-0 lg:justify-end lg:justify-self-end astro-3ef6ksr2"> <button type="button" data-header-search-button="" aria-controls="header-search-overlay" aria-expanded="false" class="hidden min-w-52 items-center justify-between gap-3 rounded-full border border-primary-surface bg-surface px-4 py-2 text-sm text-secondary transition-colors hover:bg-primary-soft-alpha hover:text-default xl:flex astro-3ef6ksr2" data-search-button-initialized="true"> <span class="truncate astro-3ef6ksr2">Start searching</span> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 shrink-0 astro-3ef6ksr2 "><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> </button> <div class="hidden lg:flex astro-3ef6ksr2"> <div data-site-visibility-exclude="chatgpt-docs" class="astro-3ef6ksr2"> <div class="flex items-center gap-2"><a target="_blank" rel="noopener noreferrer" href="https://platform.openai.com/login" class="_Button_6dmow_1 not-prose !h-9 !w-9 justify-center !px-0 min-[1000px]:!w-auto min-[1000px]:!px-4" data-color="primary" data-variant="solid" data-pill="" data-size="md"><span class="_ButtonInner_6dmow_4"><span class="sr-only min-[1000px]:not-sr-only">API Dashboard</span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" data-external-link-indicator="persistent" class="shrink-0"><path fill-rule="evenodd" d="M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z" clip-rule="evenodd"></path></svg></span></a></div> </div><div data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <div class="flex items-center gap-2"><a target="_blank" rel="noopener noreferrer" href="https://chatgpt.com/" class="_Button_6dmow_1 not-prose  !w-9 justify-center !px-0 min-[1000px]:!w-auto min-[1000px]:!px-4" data-color="primary" data-variant="solid" data-pill="" data-size="lg"><span class="_ButtonInner_6dmow_4"><span class="sr-only min-[1000px]:not-sr-only">Try ChatGPT</span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" data-external-link-indicator="persistent" class="shrink-0"><path fill-rule="evenodd" d="M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z" clip-rule="evenodd"></path></svg></span></a></div> </div> </div> <button id="header-theme-button" aria-label="Toggle light and dark theme" class="hidden lg:flex text-secondary hover:text-default transition-colors astro-3ef6ksr2"> <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg" class="block dark:hidden w-4 h-4 astro-3ef6ksr2 "><path fill-rule="evenodd" clip-rule="evenodd" d="M11 0C11.5523 0 12 0.447715 12 1V3C12 3.55228 11.5523 4 11 4C10.4477 4 10 3.55228 10 3V1C10 0.447715 10.4477 0 11 0ZM3.22183 3.22183C3.61235 2.8313 4.24551 2.8313 4.63604 3.22183L6.05025 4.63604C6.44078 5.02656 6.44078 5.65973 6.05025 6.05025C5.65973 6.44078 5.02656 6.44078 4.63604 6.05025L3.22183 4.63604C2.8313 4.24551 2.8313 3.61235 3.22183 3.22183ZM18.7782 3.22183C19.1687 3.61235 19.1687 4.24551 18.7782 4.63604L17.364 6.05025C16.9734 6.44078 16.3403 6.44078 15.9497 6.05025C15.5592 5.65973 15.5592 5.02656 15.9497 4.63604L17.364 3.22183C17.7545 2.8313 18.3876 2.8313 18.7782 3.22183ZM11 8C9.34315 8 8 9.34315 8 11C8 12.6569 9.34315 14 11 14C12.6569 14 14 12.6569 14 11C14 9.34315 12.6569 8 11 8ZM6 11C6 8.23858 8.23858 6 11 6C13.7614 6 16 8.23858 16 11C16 13.7614 13.7614 16 11 16C8.23858 16 6 13.7614 6 11ZM0 11C0 10.4477 0.447715 10 1 10H3C3.55228 10 4 10.4477 4 11C4 11.5523 3.55228 12 3 12H1C0.447715 12 0 11.5523 0 11ZM18 11C18 10.4477 18.4477 10 19 10H21C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12H19C18.4477 12 18 11.5523 18 11ZM6.05025 15.9497C6.44078 16.3403 6.44078 16.9734 6.05025 17.364L4.63604 18.7782C4.24551 19.1687 3.61235 19.1687 3.22183 18.7782C2.8313 18.3876 2.8313 17.7545 3.22183 17.364L4.63604 15.9497C5.02656 15.5592 5.65973 15.5592 6.05025 15.9497ZM15.9497 15.9497C16.3403 15.5592 16.9734 15.5592 17.364 15.9497L18.7782 17.364C19.1687 17.7545 19.1687 18.3876 18.7782 18.7782C18.3877 19.1687 17.7545 19.1687 17.364 18.7782L15.9497 17.364C15.5592 16.9734 15.5592 16.3403 15.9497 15.9497ZM11 18C11.5523 18 12 18.4477 12 19V21C12 21.5523 11.5523 22 11 22C10.4477 22 10 21.5523 10 21V19C10 18.4477 10.4477 18 11 18Z" fill="currentColor"></path></svg> <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="hidden dark:block w-4 h-4 astro-3ef6ksr2 "><path d="M10.7836 0.470481C10.9676 0.765118 10.9855 1.13415 10.8309 1.44525C10.2994 2.51497 10 3.7211 10 5.00001C10 9.41829 13.5817 13 18 13L18.0575 12.9998C18.4049 12.9974 18.7287 13.1754 18.9127 13.47C19.0968 13.7647 19.1147 14.1337 18.9601 14.4448C17.325 17.7352 13.9279 20 10 20C4.47715 20 0 15.5229 0 10C0 4.50107 4.43841 0.038857 9.92838 0.000268937C10.2758 -0.00217271 10.5995 0.175844 10.7836 0.470481ZM8.40989 2.15803C4.75344 2.8954 2 6.12619 2 10C2 14.4183 5.58172 18 10 18C12.587 18 14.8886 16.7721 16.3516 14.8648C11.6131 14.0789 8 9.96139 8 5.00001C8 4.01361 8.1431 3.05953 8.40989 2.15803Z" fill="currentColor"></path></svg> </button> <button type="button" data-header-search-button="" aria-label="Search the API docs" aria-controls="header-search-overlay" aria-expanded="false" class="text-secondary hover:text-default transition-colors md:inline-flex xl:hidden astro-3ef6ksr2" data-search-button-initialized="true"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-4 h-4 text-secondary hover:text-default transition-colors astro-3ef6ksr2 "><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> </button> <!-- Mobile Menu Button --> <button id="header-drawer-button" type="button" aria-label="Toggle menu" aria-controls="drawer" aria-expanded="false" class="lg:hidden relative right-1 text-secondary hover:text-default transition-colors astro-3ef6ksr2"> <svg width="18" height="10" viewBox="0 0 18 10" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-secondary hover:text-default transition-colors astro-3ef6ksr2 "><path d="M0 1C0 0.447715 0.447715 0 1 0H17C17.5523 0 18 0.447715 18 1C18 1.55228 17.5523 2 17 2H1C0.447715 2 0 1.55228 0 1ZM0 9C0 8.44772 0.447715 8 1 8H11C11.5523 8 12 8.44772 12 9C12 9.55229 11.5523 10 11 10H1C0.447715 10 0 9.55229 0 9Z" fill="currentColor"></path></svg> </button> </div> </div> </header> <div class="fixed inset-x-0 top-16 z-40 hidden h-12 border-b border-primary-surface bg-gray-75 dark:bg-black lg:block astro-s3vzaxny" data-context-subnav="" data-site-visibility-exclude="chatgpt-docs"> <nav aria-label="API sections" class="flex h-full items-stretch gap-1 overflow-x-auto px-6 whitespace-nowrap lg:justify-center lg:px-8 astro-s3vzaxny"> <a href="/api/docs" aria-current="true" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Overview</span> <span class="absolute inset-x-2.5 bottom-0 h-0.5 rounded-t bg-primary-solid astro-s3vzaxny" aria-hidden="true"></span> </a><a href="/api/docs/models" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Models</span>  </a><a href="/api/docs/guides/agents" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Agents</span>  </a><a href="/api/docs/guides/tools" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Tools</span>  </a><a href="/api/docs/guides/realtime" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Voice &amp; Audio</span>  </a><a href="/api/docs/guides/production-best-practices" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">Production</span>  </a><a href="/api/reference/overview" class="group relative flex shrink-0 items-center text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-4px] focus-visible:outline-primary-surface text-secondary hover:text-default astro-s3vzaxny"> <span class="px-2.5 py-1 astro-s3vzaxny">API reference</span>  </a> </nav> </div> <div id="header-search-overlay" role="dialog" aria-modal="true" aria-labelledby="header-search-title" aria-hidden="true" data-open="false" class="fixed inset-0 z-[60] hidden items-start justify-center px-4 pt-20 pb-10 md:px-6 md:pt-24 astro-3ef6ksr2" data-search-initialized="true"> <div class="absolute inset-0 bg-black/35 backdrop-blur-xs transition-opacity dark:bg-black/70 astro-3ef6ksr2" data-header-search-dismiss=""></div> <div class="relative z-10 w-full max-w-4xl overflow-hidden rounded-[28px] bg-surface shadow-[0_36px_120px_-48px_rgba(15,23,42,0.55)] ring-1 ring-black/10 dark:ring-white/10 astro-3ef6ksr2" data-header-search-panel=""> <div data-header-search-body="" class="p-0 astro-3ef6ksr2"> <h2 id="header-search-title" class="sr-only astro-3ef6ksr2"> Search the API docs </h2> <div class="relative flex min-h-0 flex-1 flex-col astro-3ef6ksr2"> <button type="button" data-header-search-close="" aria-label="Close search" class="absolute right-5 top-7 z-20 inline-flex h-8 w-8 shrink-0 appearance-none items-center justify-center rounded-md border-0 bg-transparent p-0 leading-none text-tertiary shadow-none transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-0 md:right-7 astro-3ef6ksr2"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-[18px] w-[18px] shrink-0 astro-3ef6ksr2 "><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg> </button> <astro-island uid="11cB0u" prefix="r130" component-url="/_astro/AlgoliaSearch.react.DPByk_tV.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;id&quot;:[0,&quot;header-site-search&quot;],&quot;className&quot;:[0,&quot;pagefind-header-ui pagefind-desktop-ui oai-site-search-overlay astro-3ef6ksr2&quot;],&quot;query&quot;:[0,&quot;&quot;],&quot;scope&quot;:[0,&quot;api&quot;],&quot;uiOptions&quot;:[0,{&quot;showImages&quot;:[0,false],&quot;showSubResults&quot;:[0,false],&quot;translations&quot;:[0,{&quot;placeholder&quot;:[0,&quot;Start searching&quot;],&quot;zeroResults&quot;:[0,&quot;No matches yet. Try a different keyword.&quot;]}]}]}" client="load" opts="{&quot;name&quot;:&quot;AlgoliaSearchReact&quot;,&quot;value&quot;:true}" await-children=""><div id="header-site-search" class="pagefind-header-ui pagefind-desktop-ui oai-site-search-overlay astro-3ef6ksr2 _root_1wztd_1" data-site-search-root="true" data-site-search-provider="algolia" data-site-search-variant="overlay" data-query="" data-scope="api"><div class="flex h-full min-h-0 flex-col gap-0"><div class="shrink-0 border-b border-primary-surface px-4 py-4 md:px-6 md:py-5"><label class="sr-only" for="header-site-search-input">Search docs</label><input id="header-site-search-input" type="text" placeholder="Start searching" autocomplete="off" spellcheck="false" data-site-search-input="true" class="w-full outline-none transition-colors rounded-none border-0 bg-transparent py-0 pl-0 pr-14 text-[18px] leading-tight text-default placeholder:text-tertiary focus:ring-0 md:text-[18px]" value=""></div><div class="flex min-h-0 flex-1 flex-col gap-4 px-4 py-4 md:px-6 md:py-5"><div data-site-search-empty-state="true" class="flex flex-col gap-4"><section class="_emptySection_1wztd_68" data-site-search-suggestions="true"><h3 class="_emptyHeading_1wztd_74">Suggested</h3><div class="flex flex-wrap gap-2"><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="response_format">response_format</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="reasoning_effort">reasoning_effort</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="streaming">streaming</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="tools">tools</button></div></section></div></div></div></div><!--astro:end--></astro-island> </div> </div> </div> </div> <div id="drawer" data-default-tab-id="mobile-nav-tab-1" data-default-search-placeholder="Start searching" data-default-search-scope="api" class="fixed inset-0 z-40 flex flex-col bg-surface transform translate-x-full transition-transform duration-300 lg:hidden astro-3ef6ksr2" data-mobile-nav-initialized="true"> <div class="flex flex-col h-full w-full astro-3ef6ksr2"> <div class="px-6 pt-6 w-full mt-16 astro-3ef6ksr2"> <span id="mobile-nav-primary-label" class="sr-only astro-3ef6ksr2">Primary navigation</span> <div class="flex items-center gap-2 astro-3ef6ksr2"> <nav class="min-w-0 flex-1 flex items-center gap-2 overflow-x-auto pb-2 -mx-1 px-1 astro-3ef6ksr2" role="tablist" aria-labelledby="mobile-nav-primary-label"> <button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-1" data-has-nav="true" data-href="/api/docs" data-label="API" data-search-placeholder="Start searching" data-search-scope="api" data-is-active="true" data-selected="true" aria-selected="true" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> API </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-2" data-has-nav="true" data-href="https://learn.chatgpt.com/docs" data-label="Codex" data-search-placeholder="Start searching" data-search-scope="" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> Codex </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-6" data-has-nav="true" data-href="/chatgpt" data-label="ChatGPT" data-search-placeholder="Start searching" data-search-scope="chatgpt" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> ChatGPT </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-3" data-has-nav="true" data-href="/codex" data-label="Docs" data-search-placeholder="Start searching" data-search-scope="codex" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> Docs </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-4" data-has-nav="true" data-href="/codex/use-cases" data-label="Use cases" data-search-placeholder="Start searching" data-search-scope="codex" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> Use cases </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-5" data-has-nav="true" data-href="/codex/resources" data-label="Resources" data-search-placeholder="Start searching" data-search-scope="codex" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-include="chatgpt-docs" hidden=""> Resources </button><button type="button" role="tab" data-mobile-nav-tab="" data-tab-id="mobile-nav-tab-7" data-has-nav="true" data-href="/learn" data-label="Resources" data-search-placeholder="Start searching" data-search-scope="learn" data-is-active="false" data-selected="false" aria-selected="false" class="shrink-0 rounded-full border border-primary-surface px-3.5 py-1.5 text-sm text-secondary transition-colors duration-150 data-[selected=true]:bg-primary-soft data-[selected=true]:text-default hover:bg-primary-soft-alpha hover:text-default focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-surface astro-3ef6ksr2" data-site-visibility-exclude="chatgpt-docs"> Resources </button> </nav> <button id="drawer-theme-button" type="button" aria-label="Toggle light and dark theme" class="shrink-0 mb-2 rounded-full border border-primary-surface p-2 text-secondary transition-colors hover:text-default astro-3ef6ksr2"> <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg" class="block dark:hidden w-5 h-5 astro-3ef6ksr2 "><path fill-rule="evenodd" clip-rule="evenodd" d="M11 0C11.5523 0 12 0.447715 12 1V3C12 3.55228 11.5523 4 11 4C10.4477 4 10 3.55228 10 3V1C10 0.447715 10.4477 0 11 0ZM3.22183 3.22183C3.61235 2.8313 4.24551 2.8313 4.63604 3.22183L6.05025 4.63604C6.44078 5.02656 6.44078 5.65973 6.05025 6.05025C5.65973 6.44078 5.02656 6.44078 4.63604 6.05025L3.22183 4.63604C2.8313 4.24551 2.8313 3.61235 3.22183 3.22183ZM18.7782 3.22183C19.1687 3.61235 19.1687 4.24551 18.7782 4.63604L17.364 6.05025C16.9734 6.44078 16.3403 6.44078 15.9497 6.05025C15.5592 5.65973 15.5592 5.02656 15.9497 4.63604L17.364 3.22183C17.7545 2.8313 18.3876 2.8313 18.7782 3.22183ZM11 8C9.34315 8 8 9.34315 8 11C8 12.6569 9.34315 14 11 14C12.6569 14 14 12.6569 14 11C14 9.34315 12.6569 8 11 8ZM6 11C6 8.23858 8.23858 6 11 6C13.7614 6 16 8.23858 16 11C16 13.7614 13.7614 16 11 16C8.23858 16 6 13.7614 6 11ZM0 11C0 10.4477 0.447715 10 1 10H3C3.55228 10 4 10.4477 4 11C4 11.5523 3.55228 12 3 12H1C0.447715 12 0 11.5523 0 11ZM18 11C18 10.4477 18.4477 10 19 10H21C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12H19C18.4477 12 18 11.5523 18 11ZM6.05025 15.9497C6.44078 16.3403 6.44078 16.9734 6.05025 17.364L4.63604 18.7782C4.24551 19.1687 3.61235 19.1687 3.22183 18.7782C2.8313 18.3876 2.8313 17.7545 3.22183 17.364L4.63604 15.9497C5.02656 15.5592 5.65973 15.5592 6.05025 15.9497ZM15.9497 15.9497C16.3403 15.5592 16.9734 15.5592 17.364 15.9497L18.7782 17.364C19.1687 17.7545 19.1687 18.3876 18.7782 18.7782C18.3877 19.1687 17.7545 19.1687 17.364 18.7782L15.9497 17.364C15.5592 16.9734 15.5592 16.3403 15.9497 15.9497ZM11 18C11.5523 18 12 18.4477 12 19V21C12 21.5523 11.5523 22 11 22C10.4477 22 10 21.5523 10 21V19C10 18.4477 10.4477 18 11 18Z" fill="currentColor"></path></svg> <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="hidden dark:block w-5 h-5 astro-3ef6ksr2 "><path d="M10.7836 0.470481C10.9676 0.765118 10.9855 1.13415 10.8309 1.44525C10.2994 2.51497 10 3.7211 10 5.00001C10 9.41829 13.5817 13 18 13L18.0575 12.9998C18.4049 12.9974 18.7287 13.1754 18.9127 13.47C19.0968 13.7647 19.1147 14.1337 18.9601 14.4448C17.325 17.7352 13.9279 20 10 20C4.47715 20 0 15.5229 0 10C0 4.50107 4.43841 0.038857 9.92838 0.000268937C10.2758 -0.00217271 10.5995 0.175844 10.7836 0.470481ZM8.40989 2.15803C4.75344 2.8954 2 6.12619 2 10C2 14.4183 5.58172 18 10 18C12.587 18 14.8886 16.7721 16.3516 14.8648C11.6131 14.0789 8 9.96139 8 5.00001C8 4.01361 8.1431 3.05953 8.40989 2.15803Z" fill="currentColor"></path></svg> </button> </div> </div> <div class="flex-1 w-full overflow-y-auto px-6 py-4 flex flex-col gap-6 astro-3ef6ksr2" data-mobile-nav-panels=""> <div data-mobile-search="" class="astro-3ef6ksr2"> <astro-island uid="2cRGvw" prefix="r131" component-url="/_astro/AlgoliaSearch.react.DPByk_tV.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;id&quot;:[0,&quot;header-mobile-search&quot;],&quot;className&quot;:[0,&quot;pagefind-header-ui pagefind-mobile-ui astro-3ef6ksr2&quot;],&quot;query&quot;:[0,&quot;&quot;],&quot;scope&quot;:[0,&quot;api&quot;],&quot;uiOptions&quot;:[0,{&quot;showImages&quot;:[0,false],&quot;showSubResults&quot;:[0,false],&quot;translations&quot;:[0,{&quot;placeholder&quot;:[0,&quot;Start searching&quot;],&quot;zeroResults&quot;:[0,&quot;No matches yet. Try a different keyword.&quot;]}]}]}" client="load" opts="{&quot;name&quot;:&quot;AlgoliaSearchReact&quot;,&quot;value&quot;:true}" await-children=""><div id="header-mobile-search" class="pagefind-header-ui pagefind-mobile-ui astro-3ef6ksr2 _root_1wztd_1" data-site-search-root="true" data-site-search-provider="algolia" data-site-search-variant="default" data-query="" data-scope="api"><div class="flex h-full min-h-0 flex-col gap-4"><div class=""><label class="sr-only" for="header-mobile-search-input">Search docs</label><input id="header-mobile-search-input" type="text" placeholder="Start searching" autocomplete="off" spellcheck="false" data-site-search-input="true" class="w-full outline-none transition-colors rounded-[18px] border border-transparent bg-primary-soft-alpha py-4 pl-6 pr-14 text-[18px] leading-tight text-default placeholder:text-tertiary focus:border-transparent focus:ring-0" value=""></div><div class="flex min-h-0 flex-1 flex-col gap-4"><div data-site-search-empty-state="true" class="flex flex-col gap-4"><section class="_emptySection_1wztd_68" data-site-search-suggestions="true"><h3 class="_emptyHeading_1wztd_74">Suggested</h3><div class="flex flex-wrap gap-2"><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="response_format">response_format</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="reasoning_effort">reasoning_effort</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="streaming">streaming</button><button type="button" class="_emptyChip_1wztd_81" data-search-query-button="true" data-search-query="tools">tools</button></div></section></div></div></div></div><!--astro:end--></astro-island> </div> <div id="mobile-nav-panel-1" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-1" data-href="/api/docs" data-default-variant-id="mobile-nav-tab-1-variant-0" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div class="group flex flex-col gap-1 astro-3ef6ksr2" data-mobile-context-options="" data-context-active="true" data-site-visibility-exclude="chatgpt-docs"> <button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-0" data-context-label="Overview" data-context-href="/api/docs" data-context-is-home="true" data-selected="true"> Overview </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-1" data-context-label="Models" data-context-href="/api/docs/models" data-context-is-home="false" data-selected="false"> Models </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-2" data-context-label="Agents" data-context-href="/api/docs/guides/agents" data-context-is-home="false" data-selected="false"> Agents </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-3" data-context-label="Tools" data-context-href="/api/docs/guides/tools" data-context-is-home="false" data-selected="false"> Tools </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-4" data-context-label="Voice &amp; Audio" data-context-href="/api/docs/guides/realtime" data-context-is-home="false" data-selected="false"> Voice &amp; Audio </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-5" data-context-label="Production" data-context-href="/api/docs/guides/production-best-practices" data-context-is-home="false" data-selected="false"> Production </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-1-variant-6" data-context-label="API reference" data-context-href="/api/reference/overview" data-context-is-home="false" data-selected="false"> API reference </button> </div> <div id="mobile-nav-tab-1-context-select" data-mobile-context-select="" data-value="mobile-nav-tab-1-variant-0" data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <astro-island uid="Z228nC6" prefix="r111" component-url="/_astro/MobileContextDropdown.react.CEsomyJv.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;mobile-nav-tab-1-context-select&quot;],&quot;initialValue&quot;:[0,&quot;mobile-nav-tab-1-variant-0&quot;],&quot;options&quot;:[1,[[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-0&quot;],&quot;label&quot;:[0,&quot;Overview&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-1&quot;],&quot;label&quot;:[0,&quot;Models&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-2&quot;],&quot;label&quot;:[0,&quot;Agents&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-3&quot;],&quot;label&quot;:[0,&quot;Tools&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-4&quot;],&quot;label&quot;:[0,&quot;Voice &amp; Audio&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-5&quot;],&quot;label&quot;:[0,&quot;Production&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-1-variant-6&quot;],&quot;label&quot;:[0,&quot;API reference&quot;]}]]]}" client="load" opts="{&quot;name&quot;:&quot;MobileContextDropdown&quot;,&quot;value&quot;:true}" await-children=""><div class="flex min-w-0"><div class="relative max-w-full w-full"><select aria-label="Docs section" class="_NativeSelect_10bwq_299" data-native-selectcontrol=""><option value="mobile-nav-tab-1-variant-0" selected="">Overview</option><option value="mobile-nav-tab-1-variant-1">Models</option><option value="mobile-nav-tab-1-variant-2">Agents</option><option value="mobile-nav-tab-1-variant-3">Tools</option><option value="mobile-nav-tab-1-variant-4">Voice &amp; Audio</option><option value="mobile-nav-tab-1-variant-5">Production</option><option value="mobile-nav-tab-1-variant-6">API reference</option></select><span class="_SelectControl_x887o_1" role="button" tabindex="-1" data-variant="outline" data-block="" data-size="3xl" data-selected="true" aria-disabled="false" id="select-trigger-_r111R_0_" aria-labelledby="_r111R_5H1_ _r111R_5_" aria-hidden="true"><span class="_TriggerText_x887o_510"><span id="_r111R_5H1_" class="sr-only w-full h-0 left-0 bottom-0 pointer-events-none">Docs section</span><span id="_r111R_5_">Overview</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 16 9" fill="currentColor" class="_DropdownIcon_x887o_475 _DropdownIconChevron_x887o_586"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"></path></svg></div></span></div></div><!--astro:end--></astro-island> </div>  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Get started </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/quickstart" class="px-3 py-1.5 rounded-lg transition-colors block text-default bg-primary-ghost-active " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/api/docs/guides/latest-model" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Using GPT-5.6   </a> </li><li> <a href="/api/docs/concepts" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Key concepts   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Core concepts </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/migrate-to-responses" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Responses API   </a> </li><li> <a href="/api/docs/guides/conversation-state" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Conversation state   </a> </li><li> <a href="/api/docs/guides/background" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Background mode   </a> </li><li> <a href="/api/docs/guides/streaming-responses" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Streaming   </a> </li><li> <a href="/api/docs/guides/websocket-mode" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> WebSocket mode   </a> </li><li> <a href="/api/docs/guides/responses-multi-agent" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Multi-agent   </a> </li><li> <a href="/api/docs/guides/webhooks" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Webhooks   </a> </li><li> <a href="/api/docs/guides/file-inputs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> File inputs   </a> </li><li> <a href="/api/docs/guides/compaction" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Compaction   </a> </li><li> <a href="/api/docs/guides/token-counting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Counting tokens   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> SDKs and CLI </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/libraries" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> OpenAI SDK   </a> </li><li> <a href="/api/docs/libraries/openai-cli" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> OpenAI CLI   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Resources </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/changelog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Changelog   </a> </li><li> <a href="/api/docs/deprecations" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Deprecations   </a> </li><li> <a href="/api/docs/supported-countries" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Supported countries   </a> </li><li> <a href="/api/docs/bots" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> OpenAI Crawlers   </a> </li><li> <a href="https://openai.com/policies" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Terms and policies  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Legacy APIs </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Agent Builder</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/agent-builder" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/agent-builder/migrate-from-agent-builder" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Migration guide   </a> </li><li> <a href="/api/docs/guides/node-reference" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Node reference   </a> </li><li> <a href="/api/docs/guides/agent-builder-safety" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Safety in building agents   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Evals</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/evaluation-getting-started" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Getting started   </a> </li><li> <a href="/api/docs/guides/evals" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Working with evals   </a> </li><li> <a href="/api/docs/guides/prompt-optimizer" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prompt optimizer   </a> </li><li> <a href="/api/docs/guides/external-models" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> External models   </a> </li><li> <a href="/api/docs/guides/evaluation-best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Best practices   </a> </li><li> <a href="/api/docs/guides/graders" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Graders   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Fine-tuning</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/model-optimization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Optimization cycle   </a> </li><li> <a href="/api/docs/guides/supervised-fine-tuning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Supervised fine-tuning   </a> </li><li> <a href="/api/docs/guides/vision-fine-tuning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Vision fine-tuning   </a> </li><li> <a href="/api/docs/guides/direct-preference-optimization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Direct preference optimization   </a> </li><li> <a href="/api/docs/guides/reinforcement-fine-tuning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Reinforcement fine-tuning   </a> </li><li> <a href="/api/docs/guides/rft-use-cases" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> RFT use cases   </a> </li><li> <a href="/api/docs/guides/fine-tuning-best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Best practices   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Assistants API</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/assistants/migration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Migration guide   </a> </li><li> <a href="/api/docs/assistants/deep-dive" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Deep dive   </a> </li><li> <a href="/api/docs/assistants/tools" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Tools   </a> </li> </ul> </details> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-1" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/models" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Model catalog   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Choose a model </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/pricing" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Pricing   </a> </li><li> <a href="/api/docs/guides/model-selection" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Model selection   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Text and code </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/text" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Text generation   </a> </li><li> <a href="/api/docs/guides/code-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Code generation   </a> </li><li> <a href="/api/docs/guides/structured-outputs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Structured output   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Prompting </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/prompting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/prompt-engineering" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prompt engineering   </a> </li><li> <a href="/api/docs/guides/citation-formatting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Citation formatting   </a> </li><li> <a href="/api/docs/guides/prompting/migrate-from-prompt-object" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Migration guide   </a> </li><li> <a href="/api/docs/guides/prompt-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prompt generation   </a> </li><li> <a href="/api/docs/guides/frontend-prompt" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Frontend prompting   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Reasoning </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/reasoning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Reasoning models   </a> </li><li> <a href="/api/docs/guides/reasoning-best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Reasoning best practices   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Images and video </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/images-vision" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Images and vision   </a> </li><li> <a href="/api/docs/guides/image-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image generation   </a> </li><li> <a href="/api/docs/guides/video-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Video generation   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Realtime and audio </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/audio" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Audio and speech   </a> </li><li> <a href="/api/docs/guides/realtime" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/voice-agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Voice agents   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Specialized models </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/deep-research" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Deep research   </a> </li><li> <a href="/api/docs/guides/embeddings" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Embeddings   </a> </li><li> <a href="/api/docs/guides/moderation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Moderation   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-2" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Agents SDK </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/agents/quickstart" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/api/docs/guides/agents/define-agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Agent definitions   </a> </li><li> <a href="/api/docs/guides/agents/models" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Models and providers   </a> </li><li> <a href="/api/docs/guides/agents/running-agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Running agents   </a> </li><li> <a href="/api/docs/guides/agents/sandboxes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Sandbox agents   </a> </li><li> <a href="/api/docs/guides/agents/orchestration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Orchestration   </a> </li><li> <a href="/api/docs/guides/agents/guardrails-approvals" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Guardrails   </a> </li><li> <a href="/api/docs/guides/agents/results" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Results and state   </a> </li><li> <a href="/api/docs/guides/agents/integrations-observability" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Integrations and observability   </a> </li><li> <a href="/api/docs/guides/agent-evals" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Evaluate agent workflows   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> ChatKit </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/chatkit" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/chatkit-themes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Customize   </a> </li><li> <a href="/api/docs/guides/chatkit-widgets" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Widgets   </a> </li><li> <a href="/api/docs/guides/chatkit-actions" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Actions   </a> </li><li> <a href="/api/docs/guides/custom-chatkit" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Advanced integrations   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-3" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/function-calling" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Function calling   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Search and retrieval </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools-web-search" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Web search   </a> </li><li> <a href="/api/docs/guides/tools-file-search" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> File search   </a> </li><li> <a href="/api/docs/guides/retrieval" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Retrieval   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Connect tools and data </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools-connectors-mcp" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> MCP and Connectors   </a> </li><li> <a href="/api/docs/guides/secure-mcp-tunnels" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Secure MCP Tunnel   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Build tool workflows </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools-skills" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Skills   </a> </li><li> <a href="/api/docs/guides/tools-tool-search" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Tool search   </a> </li><li> <a href="/api/docs/guides/tools-programmatic-tool-calling" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Programmatic tool calling   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Computer and code </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools-shell" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Shell   </a> </li><li> <a href="/api/docs/guides/tools-computer-use" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Computer use   </a> </li><li> <a href="/api/docs/guides/tools-apply-patch" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Apply Patch   </a> </li><li> <a href="/api/docs/guides/tools-local-shell" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Local shell   </a> </li><li> <a href="/api/docs/guides/tools-code-interpreter" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Code interpreter   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Media </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/tools-image-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image generation   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-4" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/realtime" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Get started </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/voice-agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Voice agents   </a> </li><li> <a href="/api/docs/guides/realtime-translation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Live translation   </a> </li><li> <a href="/api/docs/guides/realtime-models-prompting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Realtime prompting guide   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Audio </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/audio" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Audio and speech   </a> </li><li> <a href="/api/docs/guides/transcription" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Transcription   </a> </li><li> <a href="/api/docs/guides/speech-to-text" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> File transcription   </a> </li><li> <a href="/api/docs/guides/realtime-transcription" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Realtime transcription   </a> </li><li> <a href="/api/docs/guides/text-to-speech" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Speech generation   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Connection methods </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/realtime-webrtc" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> WebRTC   </a> </li><li> <a href="/api/docs/guides/realtime-websocket" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> WebSocket   </a> </li><li> <a href="/api/docs/guides/realtime-sip" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> SIP   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Sessions and operations </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/realtime-conversations" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Managing conversations   </a> </li><li> <a href="/api/docs/guides/realtime-vad" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Voice activity detection   </a> </li><li> <a href="/api/docs/guides/realtime-mcp" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Realtime with tools   </a> </li><li> <a href="/api/docs/guides/realtime-server-controls" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Webhooks and server-side controls   </a> </li><li> <a href="/api/docs/guides/realtime-costs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Managing costs   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-5" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Go live </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/production-best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Production best practices   </a> </li><li> <a href="/api/docs/guides/deployment-checklist" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Deployment checklist   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Performance and quality </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/latency-optimization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Latency optimization   </a> </li><li> <a href="/api/docs/guides/predicted-outputs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Predicted Outputs   </a> </li><li> <a href="/api/docs/guides/fast-mode" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Fast mode   </a> </li><li> <a href="/api/docs/guides/optimizing-llm-accuracy" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Accuracy optimization   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Cost and throughput </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/cost-optimization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Cost optimization   </a> </li><li> <a href="/api/docs/guides/prompt-caching" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prompt caching   </a> </li><li> <a href="/api/docs/guides/batch" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Batch   </a> </li><li> <a href="/api/docs/guides/flex-processing" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Flex processing   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Safety and governance </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/safety-best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Safety best practices   </a> </li><li> <a href="/api/docs/guides/red-teaming" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Red teaming   </a> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <a href="/api/docs/guides/safety-checks" class="flex-1 " data-mobile-nav-link=""> Safety checks  </a> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/safety-checks/cybersecurity" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Cybersecurity checks   </a> </li><li> <a href="/api/docs/guides/safety-checks/under-18-api-guidance" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Under 18 API Guidance   </a> </li> </ul> </details> </li><li> <a href="/api/docs/guides/content-provenance" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Content provenance   </a> </li><li> <a href="/api/docs/guides/your-data" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Your data   </a> </li><li> <a href="/api/docs/guides/rbac" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Permissions   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Infrastructure and access </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <a href="/api/docs/guides/terraform" class="flex-1 " data-mobile-nav-link=""> Terraform provider  </a> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/terraform" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/api/docs/guides/terraform/projects-and-access" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Projects and access   </a> </li><li> <a href="/api/docs/guides/terraform/service-accounts" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Service accounts   </a> </li><li> <a href="/api/docs/guides/terraform/rate-limits-and-spend" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Rate limits and spend   </a> </li><li> <a href="/api/docs/guides/terraform/project-controls" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Model, tool, and data controls   </a> </li><li> <a href="/api/docs/guides/terraform/import-and-reconcile" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Import and reconciliation   </a> </li> </ul> </details> </li><li> <a href="/api/docs/guides/private-link" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Private Link   </a> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <a href="/api/docs/guides/workload-identity-federation" class="flex-1 " data-mobile-nav-link=""> Workload identity federation  </a> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/workload-identity-federation/x509" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> X.509 certificates (beta)   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/kubernetes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Kubernetes   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/aws" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> AWS   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/microsoft-azure" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Microsoft Azure   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/google-cloud" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Google Cloud   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/oracle-cloud" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Oracle Cloud Infrastructure   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/github-actions" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> GitHub Actions   </a> </li><li> <a href="/api/docs/guides/workload-identity-federation/spiffe" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> SPIFFE   </a> </li> </ul> </details> </li><li> <a href="/api/docs/guides/ip-addresses" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> IP egress ranges   </a> </li><li> <a href="/api/docs/guides/amazon-bedrock" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Amazon Bedrock   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Operations </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/api/docs/guides/rate-limits" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Rate limits   </a> </li><li> <a href="/api/docs/guides/spend-limits" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Spend limits   </a> </li><li> <a href="/api/docs/guides/admin-apis" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Admin APIs   </a> </li><li> <a href="/api/docs/guides/error-codes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Error codes   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-1-variant-6" hidden="true" class="flex flex-col gap-6 astro-3ef6ksr2">  </div> </div><div id="mobile-nav-panel-2" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-2" data-href="https://learn.chatgpt.com/docs" data-default-variant-id="mobile-nav-tab-2-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div class="group flex flex-col gap-1 astro-3ef6ksr2" data-mobile-context-options="" data-context-active="false" data-site-visibility-exclude="chatgpt-docs"> <a href="https://learn.chatgpt.com/docs" target="_blank" rel="noopener noreferrer" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default astro-3ef6ksr2" data-mobile-nav-link=""> Docs </a><a href="https://learn.chatgpt.com/use-cases" target="_blank" rel="noopener noreferrer" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default astro-3ef6ksr2" data-mobile-nav-link=""> Use cases </a> </div> <div id="mobile-nav-tab-2-context-select" data-mobile-context-select="" data-value="mobile-nav-tab-2-variant-0" data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <astro-island uid="1emrvm" prefix="r112" component-url="/_astro/MobileContextDropdown.react.CEsomyJv.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;mobile-nav-tab-2-context-select&quot;],&quot;initialValue&quot;:[0,&quot;mobile-nav-tab-2-variant-0&quot;],&quot;options&quot;:[1,[[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-2-variant-0&quot;],&quot;label&quot;:[0,&quot;Docs&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-2-variant-1&quot;],&quot;label&quot;:[0,&quot;Use cases&quot;]}]]]}" client="load" opts="{&quot;name&quot;:&quot;MobileContextDropdown&quot;,&quot;value&quot;:true}" await-children=""><div class="flex min-w-0"><div class="relative max-w-full w-full"><select aria-label="Docs section" class="_NativeSelect_10bwq_299" data-native-selectcontrol=""><option value="mobile-nav-tab-2-variant-0" selected="">Docs</option><option value="mobile-nav-tab-2-variant-1">Use cases</option></select><span class="_SelectControl_x887o_1" role="button" tabindex="-1" data-variant="outline" data-block="" data-size="3xl" data-selected="true" aria-disabled="false" id="select-trigger-_r112R_0_" aria-labelledby="_r112R_5H1_ _r112R_5_" aria-hidden="true"><span class="_TriggerText_x887o_510"><span id="_r112R_5H1_" class="sr-only w-full h-0 left-0 bottom-0 pointer-events-none">Docs section</span><span id="_r112R_5_">Docs</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 16 9" fill="currentColor" class="_DropdownIcon_x887o_475 _DropdownIconChevron_x887o_586"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"></path></svg></div></span></div></div><!--astro:end--></astro-island> </div>  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-2-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2">  </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-2-variant-1" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2">  </div> </div><div id="mobile-nav-panel-6" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-6" data-href="/chatgpt" data-default-variant-id="mobile-nav-tab-6-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div class="group flex flex-col gap-1 astro-3ef6ksr2" data-mobile-context-options="" data-context-active="false" data-site-visibility-exclude="chatgpt-docs"> <button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-6-variant-1" data-context-label="Plugins" data-context-href="/plugins" data-context-is-home="false" data-selected="false"> Plugins </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-6-variant-2" data-context-label="Workspace Agents" data-context-href="/workspace-agents" data-context-is-home="false" data-selected="false"> Workspace Agents </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-6-variant-3" data-context-label="Commerce" data-context-href="/commerce" data-context-is-home="false" data-selected="false"> Commerce </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-6-variant-4" data-context-label="Ads" data-context-href="/ads" data-context-is-home="false" data-selected="false"> Ads </button> </div> <div id="mobile-nav-tab-6-context-select" data-mobile-context-select="" data-value="mobile-nav-tab-6-variant-0" data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <astro-island uid="Z21AQ9b" prefix="r113" component-url="/_astro/MobileContextDropdown.react.CEsomyJv.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;mobile-nav-tab-6-context-select&quot;],&quot;initialValue&quot;:[0,&quot;mobile-nav-tab-6-variant-0&quot;],&quot;options&quot;:[1,[[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-6-variant-1&quot;],&quot;label&quot;:[0,&quot;Plugins&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-6-variant-2&quot;],&quot;label&quot;:[0,&quot;Workspace Agents&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-6-variant-3&quot;],&quot;label&quot;:[0,&quot;Commerce&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-6-variant-4&quot;],&quot;label&quot;:[0,&quot;Ads&quot;]}]]]}" client="load" opts="{&quot;name&quot;:&quot;MobileContextDropdown&quot;,&quot;value&quot;:true}" await-children=""><div class="flex min-w-0"><div class="relative max-w-full w-full"><select aria-label="Docs section" class="_NativeSelect_10bwq_299" data-native-selectcontrol=""><option value="mobile-nav-tab-6-variant-1">Plugins</option><option value="mobile-nav-tab-6-variant-2">Workspace Agents</option><option value="mobile-nav-tab-6-variant-3">Commerce</option><option value="mobile-nav-tab-6-variant-4">Ads</option></select><span class="_SelectControl_x887o_1" role="button" tabindex="-1" data-variant="outline" data-block="" data-size="3xl" data-selected="true" aria-disabled="false" id="select-trigger-_r113R_0_" aria-labelledby="_r113R_5H1_ _r113R_5_" aria-hidden="true"><span class="_TriggerText_x887o_510"><span id="_r113R_5H1_" class="sr-only w-full h-0 left-0 bottom-0 pointer-events-none">Docs section</span><span id="_r113R_5_">Select...</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 16 9" fill="currentColor" class="_DropdownIcon_x887o_475 _DropdownIconChevron_x887o_586"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"></path></svg></div></span></div></div><!--astro:end--></astro-island> </div>  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-6-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2">  </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-6-variant-1" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li><li> <a href="/plugins/quickstart" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Core concepts </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/concepts/plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Plugin architecture   </a> </li><li> <a href="/plugins/concepts/skills" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Skills   </a> </li><li> <a href="/plugins/concepts/mcp-server" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> MCP server   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Plan </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/plan/use-case" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Brainstorm use cases   </a> </li><li> <a href="/plugins/plan/tools" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Define tools   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Build </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/build/mcp-server" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Build an MCP server   </a> </li><li> <a href="/plugins/build/chatgpt-ui" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Add UI to your MCP server (optional)   </a> </li><li> <a href="/plugins/build/auth" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Authenticate users   </a> </li><li> <a href="/plugins/build/skills" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Build skills   </a> </li><li> <a href="/plugins/build/plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Package your plugin   </a> </li><li> <a href="/plugins/build/examples" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Examples   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Test and publish </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/deploy/connect-chatgpt" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Connect and test your plugin   </a> </li><li> <a href="/plugins/deploy/submission" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Submit and publish   </a> </li><li> <a href="/plugins/deploy/submission-errors" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Submission error reference   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Conversion specs </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/guides/restaurant-reservation-conversion-spec" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Restaurant reservation spec   </a> </li><li> <a href="/plugins/guides/local-services-request-quote-conversion-spec" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Get Quote spec   </a> </li><li> <a href="/plugins/guides/product-checkout-conversion-spec" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Product checkout spec   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Guides </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/concepts/ui-guidelines" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> UI guidelines   </a> </li><li> <a href="/plugins/guides/optimize-metadata" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Optimize Metadata   </a> </li><li> <a href="/plugins/guides/security-privacy" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Security &amp; Privacy   </a> </li><li> <a href="/plugins/deploy/troubleshooting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Troubleshooting   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Resources </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/plugins/changelog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Changelog   </a> </li><li> <a href="/plugins/app-guidelines" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Plugin guidelines   </a> </li><li> <a href="/plugins/deploy/app-review" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> MCP server review requirements   </a> </li><li> <a href="/plugins/reference" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Plugin UI reference   </a> </li><li> <a href="/plugins/build/monetization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Checkout API reference   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-6-variant-2" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/workspace-agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Get started </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/workspace-agents/trigger-runs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Trigger workspace agent runs   </a> </li><li> <a href="/workspace-agents/authentication" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Authenticate with Workspace Agent access tokens   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-6-variant-3" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/commerce" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Guides </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/commerce/guides/get-started" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Get started   </a> </li><li> <a href="/commerce/guides/best-practices" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Best practices   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> File Upload </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/commerce/specs/file-upload/overview" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/commerce/specs/file-upload/products" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Products   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> API </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/commerce/specs/api/overview" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/commerce/specs/api/feeds" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Feeds   </a> </li><li> <a href="/commerce/specs/api/products" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Products   </a> </li><li> <a href="/commerce/specs/api/promotions" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Promotions   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-6-variant-4" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/ads" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Ads Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Measurement </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/ads/measurement-pixel" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Measurement Pixel   </a> </li><li> <a href="/ads/multiple-pixels" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Multiple Pixels (Advanced)   </a> </li><li> <a href="/ads/image-tag" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image Tag   </a> </li><li> <a href="/ads/conversions-api" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Conversions API   </a> </li><li> <a href="/ads/supported-events" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Supported Events   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Advertiser API </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/ads/api-overview" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/ads/api-partner-setup" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> API Partner Setup   </a> </li><li> <a href="/ads/api-quickstart" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/ads/bulk-api" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Bulk API   </a> </li><li> <a href="/ads/product-feeds" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Product Feeds   </a> </li><li> <a href="/ads/campaign-targeting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Campaign Targeting   </a> </li><li> <a href="/ads/conversion-optimized-campaigns" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Conversion-Optimized Campaigns   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> API Reference </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/ads/api-reference/authentication" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Authentication   </a> </li><li> <a href="/ads/api-reference/ad-account" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Ad Account   </a> </li><li> <a href="/ads/api-reference/campaigns" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Campaigns   </a> </li><li> <a href="/ads/api-reference/ad-groups" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Ad Groups   </a> </li><li> <a href="/ads/api-reference/ads" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Ads   </a> </li><li> <a href="/ads/api-reference/insights" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Insights   </a> </li><li> <a href="/ads/api-reference/files" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Files   </a> </li><li> <a href="/ads/api-reference/conversion-setup" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Conversion Setup   </a> </li> </ul> </div> </div> </div><div id="mobile-nav-panel-3" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-3" data-href="/codex" data-default-variant-id="mobile-nav-tab-3-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div class="group flex flex-col gap-1 astro-3ef6ksr2" data-mobile-context-options="" data-context-active="false" data-site-visibility-exclude="chatgpt-docs"> <button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-0" data-context-label="Overview" data-context-href="/codex" data-context-is-home="true" data-selected="true"> Overview </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-1" data-context-label="Features" data-context-href="/codex/features" data-context-is-home="false" data-selected="false"> Features </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-2" data-context-label="Configuration" data-context-href="/codex/configuration" data-context-is-home="false" data-selected="false"> Configuration </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-3" data-context-label="Developers" data-context-href="/codex/developers" data-context-is-home="false" data-selected="false"> Developers </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-4" data-context-label="Security" data-context-href="/codex/security-administration" data-context-is-home="false" data-selected="false"> Security </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-5" data-context-label="Administration" data-context-href="/codex/administration" data-context-is-home="false" data-selected="false"> Administration </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-6" data-context-label="Use Cases" data-context-href="/codex/use-cases" data-context-is-home="false" data-selected="false" data-site-visibility-exclude="chatgpt-docs"> Use Cases </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-3-variant-7" data-context-label="Resources" data-context-href="/codex/resources" data-context-is-home="false" data-selected="false" data-site-visibility-exclude="chatgpt-docs"> Resources </button> </div> <div id="mobile-nav-tab-3-context-select" data-mobile-context-select="" data-value="mobile-nav-tab-3-variant-0" data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <astro-island uid="19TVzG" prefix="r114" component-url="/_astro/MobileContextDropdown.react.CEsomyJv.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;mobile-nav-tab-3-context-select&quot;],&quot;initialValue&quot;:[0,&quot;mobile-nav-tab-3-variant-0&quot;],&quot;options&quot;:[1,[[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-0&quot;],&quot;label&quot;:[0,&quot;Overview&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-1&quot;],&quot;label&quot;:[0,&quot;Features&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-2&quot;],&quot;label&quot;:[0,&quot;Configuration&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-3&quot;],&quot;label&quot;:[0,&quot;Developers&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-4&quot;],&quot;label&quot;:[0,&quot;Security&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-5&quot;],&quot;label&quot;:[0,&quot;Administration&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-6&quot;],&quot;label&quot;:[0,&quot;Use Cases&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-3-variant-7&quot;],&quot;label&quot;:[0,&quot;Resources&quot;]}]]]}" client="load" opts="{&quot;name&quot;:&quot;MobileContextDropdown&quot;,&quot;value&quot;:true}" await-children=""><div class="flex min-w-0"><div class="relative max-w-full w-full"><select aria-label="Docs section" class="_NativeSelect_10bwq_299" data-native-selectcontrol=""><option value="mobile-nav-tab-3-variant-0" selected="">Overview</option><option value="mobile-nav-tab-3-variant-1">Features</option><option value="mobile-nav-tab-3-variant-2">Configuration</option><option value="mobile-nav-tab-3-variant-3">Developers</option><option value="mobile-nav-tab-3-variant-4">Security</option><option value="mobile-nav-tab-3-variant-5">Administration</option><option value="mobile-nav-tab-3-variant-6">Use Cases</option><option value="mobile-nav-tab-3-variant-7">Resources</option></select><span class="_SelectControl_x887o_1" role="button" tabindex="-1" data-variant="outline" data-block="" data-size="3xl" data-selected="true" aria-disabled="false" id="select-trigger-_r114R_0_" aria-labelledby="_r114R_5H1_ _r114R_5_" aria-hidden="true"><span class="_TriggerText_x887o_510"><span id="_r114R_5H1_" class="sr-only w-full h-0 left-0 bottom-0 pointer-events-none">Docs section</span><span id="_r114R_5_">Overview</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 16 9" fill="currentColor" class="_DropdownIcon_x887o_475 _DropdownIconChevron_x887o_586"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"></path></svg></div></span></div></div><!--astro:end--></astro-island> </div>  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Get started </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/quickstart" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/codex/use-chatgpt" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Use ChatGPT   </a> </li><li> <a href="/codex/get-started-with-work" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Get started with Work   </a> </li><li> <a href="/codex/import" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Import from another agent   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Foundations </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/prompting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prompting   </a> </li><li> <a href="/codex/personalize" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Personalize ChatGPT   </a> </li><li> <a href="/codex/skills-and-plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Skills &amp; Plugins   </a> </li><li> <a href="/codex/permission-modes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Permissions   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Explore </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/whats-new" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> What's new   </a> </li><li> <a href="/codex/models" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Models   </a> </li><li> <a href="/codex/pricing" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Pricing   </a> </li><li> <a href="/codex/glossary" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Glossary   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Available on </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/app" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> ChatGPT desktop app   </a> </li><li> <a href="/codex/remote" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Remote   </a> </li><li> <a href="/codex/web" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> ChatGPT on the web   </a> </li><li> <a href="/codex/cli" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex CLI   </a> </li><li> <a href="/codex/ide" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex IDE extension   </a> </li><li> <a href="/codex/cloud" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex cloud   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Releases </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/changelog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Changelog   </a> </li><li> <a href="/codex/feature-maturity" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Feature Maturity   </a> </li><li> <a href="/codex/open-source" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Open Source   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-1" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/features" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Workflows </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/projects" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Projects and chats   </a> </li><li> <a href="/codex/sites" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Sites   </a> </li><li> <a href="/codex/visualizations" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Visualizations   </a> </li><li> <a href="/codex/automations" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Scheduled tasks   </a> </li><li> <a href="/codex/long-running-work" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Long-running work   </a> </li><li> <a href="/codex/notifications" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Notifications   </a> </li><li> <a href="/codex/pets" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Pets   </a> </li><li> <a href="/codex/features/codex-micro" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex Micro   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Capabilities </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/browser" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Browser   </a> </li><li> <a href="/codex/computer-use" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Computer use   </a> </li><li> <a href="/codex/features/voice" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Voice   </a> </li><li> <a href="/codex/plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Plugins   </a> </li><li> <a href="/codex/web-search" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Web search   </a> </li><li> <a href="/codex/image-generation" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image generation   </a> </li><li> <a href="/codex/image-inputs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image inputs   </a> </li><li> <a href="/codex/appshots" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Appshots   </a> </li><li> <a href="/codex/chrome-extension" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Chrome extension   </a> </li><li> <a href="/codex/artifacts-viewer" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Work with files   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Reference </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/reference/commands" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Commands   </a> </li><li> <a href="/codex/reference/slash-commands" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Slash commands   </a> </li><li> <a href="/codex/reference/settings" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Settings   </a> </li><li> <a href="/codex/reference/troubleshooting" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Troubleshooting   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-2" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/configuration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Customization </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/customization/overview" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <a href="/codex/customization/memories" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Memories   </a> </li><li> <a href="/codex/customization/chronicle" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Chronicle   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Config file </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/config-file/config-basic" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Config Basics   </a> </li><li> <a href="/codex/config-file/config-advanced" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Advanced Config   </a> </li><li> <a href="/codex/config-file/config-reference" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Config Reference   </a> </li><li> <a href="/codex/config-file/environment-variables" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Environment Variables   </a> </li><li> <a href="/codex/config-file/config-sample" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Sample Config   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Agent configuration </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/agent-configuration/agents-md" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> AGENTS.md   </a> </li><li> <a href="/codex/agent-configuration/subagents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Subagents   </a> </li><li> <a href="/codex/agent-configuration/speed" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Speed   </a> </li><li> <a href="/codex/agent-configuration/rules" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Rules   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Extend ChatGPT and Codex </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/extend/record-and-replay" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Record &amp; Replay   </a> </li><li> <a href="/codex/extend/mcp" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> MCP   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Windows </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/windows/windows-app" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Desktop app   </a> </li><li> <a href="/codex/windows/windows-sandbox" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Windows sandbox   </a> </li><li> <a href="/codex/windows/wsl" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> WSL   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-3" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/developers" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Development workflows </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/code-review" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Code review   </a> </li><li> <a href="/codex/integrated-terminal" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Integrated terminal   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Extend and automate </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/build-skills" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Build skills   </a> </li><li> <a href="/codex/build-plugins" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Build plugins   </a> </li><li> <a href="/codex/hooks" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Hooks   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Environments </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/environments/modes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Modes   </a> </li><li> <a href="/codex/environments/local-environment" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Local environments   </a> </li><li> <a href="/codex/environments/cloud-environment" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Cloud environment   </a> </li><li> <a href="/codex/environments/git-worktrees" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Git worktrees   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Build with Codex </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/codex-sdk" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex SDK   </a> </li><li> <a href="/codex/app-server" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> App Server   </a> </li><li> <a href="/codex/mcp-server" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> MCP Server   </a> </li><li> <a href="/codex/github-action" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> GitHub Action   </a> </li><li> <a href="/codex/non-interactive-mode" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Non-interactive mode   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Third-party integrations </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/third-party/github" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> GitHub   </a> </li><li> <a href="/codex/third-party/slack" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Slack   </a> </li><li> <a href="/codex/third-party/linear" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Linear   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Reference </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/cli-customization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> CLI customization   </a> </li><li> <a href="/codex/developer-commands" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Developer commands   </a> </li><li> <a href="/codex/developer-settings" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Developer settings   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-4" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/security-administration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Permissions </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/permissions" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Profiles   </a> </li><li> <a href="/codex/sandboxing" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Sandboxing   </a> </li><li> <a href="/codex/sandboxing/auto-review" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Auto-review   </a> </li><li> <a href="/codex/agent-approvals-security" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Agent approvals &amp; security   </a> </li><li> <a href="/codex/cloud/internet-access" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Internet access   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Codex Security </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/security" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Codex Security plugin</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/security/plugin" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/codex/security/plugin/scans" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Run a security scan   </a> </li><li> <a href="/codex/security/plugin/deep-scans" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Run a deep scan   </a> </li><li> <a href="/codex/security/plugin/code-changes" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Review code changes   </a> </li><li> <a href="/codex/security/plugin/workbench" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Use the Security workbench   </a> </li><li> <a href="/codex/security/plugin/triage-backlog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Triage a backlog   </a> </li><li> <a href="/codex/security/plugin/fix-findings" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Fix findings   </a> </li><li> <a href="/codex/security/plugin/security-hardening" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Propose security hardening   </a> </li><li> <a href="/codex/security/plugin/vulnerability-reports" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Write vulnerability reports   </a> </li><li> <a href="/codex/security/plugin/export-findings" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Export and track findings   </a> </li><li> <a href="/codex/security/plugin/changelog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Changelog   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Codex Security CLI</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/security/cli" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Quickstart   </a> </li><li> <a href="/codex/security/cli/bulk-scans" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Run bulk scans   </a> </li><li> <a href="/codex/security/cli/ci" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Run scans in CI   </a> </li><li> <a href="/codex/security/cli/reference" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Reference   </a> </li><li> <a href="/codex/security/cli/faq" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> FAQ   </a> </li> </ul> </details> </li><li> <a href="/codex/security/sdk" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> TypeScript SDK   </a> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-2 rounded-lg transition-colors flex items-center justify-between gap-2 hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1">Codex Security cloud</span> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block text-secondary transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/security/setup" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Setup   </a> </li><li> <a href="/codex/security/security-review" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Security Review   </a> </li><li> <a href="/codex/security/threat-model" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Improving the threat model   </a> </li><li> <a href="/codex/security/faq" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> FAQ   </a> </li> </ul> </details> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Safety </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/cyber-safety" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Cyber Safety   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-5" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/administration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Overview   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Getting started </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/enterprise/admin-setup" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Admin rollout guide   </a> </li><li> <a href="/codex/enterprise/work-admin-faq" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> ChatGPT Work admin FAQ   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Identity and authentication </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/auth" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Authentication overview   </a> </li><li> <a href="/codex/enterprise/access-tokens" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Access tokens   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Workspace access, policy, and models </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/enterprise/groups-and-provisioning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Groups and provisioning   </a> </li><li> <a href="/codex/enterprise/roles-and-workspace-permissions" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Roles and workspace permissions   </a> </li><li> <a href="/codex/enterprise/managed-configuration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Managed configuration   </a> </li><li> <a href="/codex/enterprise/prisma-airs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Prisma AIRS   </a> </li><li> <a href="/codex/hipaa-configuration" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> HIPAA configuration   </a> </li><li> <a href="/codex/enterprise/workspace-model-availability" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Workspace model availability   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Plugin and connector controls </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/enterprise/apps-and-connectors" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Plugin controls   </a> </li><li> <a href="/codex/enterprise/skills" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Skill controls   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Usage, governance, and compliance </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/enterprise/governance" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Governance   </a> </li><li> <a href="/codex/enterprise/workspace-analytics" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Workspace analytics   </a> </li><li> <a href="/codex/enterprise/analytics-api" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Analytics API   </a> </li><li> <a href="/codex/enterprise/compliance-api" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Compliance API and audit events   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Deployment and model providers </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/enterprise/manage-app-updates" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Manage app updates   </a> </li><li> <a href="/codex/enterprise/windows-deployment" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Windows app deployment   </a> </li><li> <a href="/codex/remote-connections" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Remote connections   </a> </li><li> <a href="/codex/amazon-bedrock" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Amazon Bedrock   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-6" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://learn.chatgpt.com/use-cases" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Explore use cases   </a> </li><li> <a href="https://learn.chatgpt.com/use-cases/collections" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Collections   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-3-variant-7" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/resources" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li><li> <a href="/codex/videos" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Videos   </a> </li><li> <a href="https://developers.openai.com/showcase" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Showcase  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://openai.com/academy/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> OpenAI Academy  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://academy.openai.com/home/events" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Online trainings  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Community </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://developers.openai.com/community/codex-ambassadors" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex Ambassadors  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/students" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex for Students  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/codex-for-oss" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex for Open Source  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/meetups" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Meetups  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Blog </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://openai.com/news/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Company blog  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/blog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Developer blog  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div> </div> </div><div id="mobile-nav-panel-4" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-4" data-href="/codex/use-cases" data-default-variant-id="mobile-nav-tab-4-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-4-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://learn.chatgpt.com/use-cases" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Explore use cases   </a> </li><li> <a href="https://learn.chatgpt.com/use-cases/collections" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Collections   </a> </li> </ul> </div> </div> </div><div id="mobile-nav-panel-5" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-5" data-href="/codex/resources" data-default-variant-id="mobile-nav-tab-5-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-5-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/codex/resources" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li><li> <a href="/codex/videos" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Videos   </a> </li><li> <a href="https://developers.openai.com/showcase" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Showcase  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://openai.com/academy/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> OpenAI Academy  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://academy.openai.com/home/events" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Online trainings  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Community </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://developers.openai.com/community/codex-ambassadors" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex Ambassadors  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/students" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex for Students  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/codex-for-oss" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Codex for Open Source  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/community/meetups" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Meetups  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Blog </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://openai.com/news/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Company blog  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://developers.openai.com/blog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Developer blog  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div> </div> </div><div id="mobile-nav-panel-7" data-mobile-nav-content="" data-tab-id="mobile-nav-tab-7" data-href="/learn" data-default-variant-id="mobile-nav-tab-7-variant-0" hidden="true" class="flex flex-col gap-4 pb-8 astro-3ef6ksr2">  <div class="group flex flex-col gap-1 astro-3ef6ksr2" data-mobile-context-options="" data-context-active="false" data-site-visibility-exclude="chatgpt-docs"> <a href="/showcase" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default astro-3ef6ksr2" data-mobile-nav-link=""> Showcase </a><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-7-variant-2" data-context-label="Blog" data-context-href="/blog" data-context-is-home="false" data-selected="false"> Blog </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-7-variant-3" data-context-label="Cookbook" data-context-href="/cookbook" data-context-is-home="false" data-selected="false"> Cookbook </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-7-variant-4" data-context-label="Learn" data-context-href="/learn" data-context-is-home="false" data-selected="false"> Learn </button><button type="button" class="w-full rounded-lg px-3 py-2 text-left text-sm font-normal text-secondary transition-colors hover:bg-primary-ghost-hover hover:text-default data-[selected=true]:bg-primary-ghost-active data-[selected=true]:text-default group-data-[context-active=true]:font-semibold astro-3ef6ksr2" data-mobile-context-option="" data-context-id="mobile-nav-tab-7-variant-5" data-context-label="Community" data-context-href="/community" data-context-is-home="false" data-selected="false"> Community </button> </div> <div id="mobile-nav-tab-7-context-select" data-mobile-context-select="" data-value="mobile-nav-tab-7-variant-0" data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <astro-island uid="m0vRD" prefix="r115" component-url="/_astro/MobileContextDropdown.react.CEsomyJv.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;mobile-nav-tab-7-context-select&quot;],&quot;initialValue&quot;:[0,&quot;mobile-nav-tab-7-variant-0&quot;],&quot;options&quot;:[1,[[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-7-variant-1&quot;],&quot;label&quot;:[0,&quot;Showcase&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-7-variant-2&quot;],&quot;label&quot;:[0,&quot;Blog&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-7-variant-3&quot;],&quot;label&quot;:[0,&quot;Cookbook&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-7-variant-4&quot;],&quot;label&quot;:[0,&quot;Learn&quot;]}],[0,{&quot;value&quot;:[0,&quot;mobile-nav-tab-7-variant-5&quot;],&quot;label&quot;:[0,&quot;Community&quot;]}]]]}" client="load" opts="{&quot;name&quot;:&quot;MobileContextDropdown&quot;,&quot;value&quot;:true}" await-children=""><div class="flex min-w-0"><div class="relative max-w-full w-full"><select aria-label="Docs section" class="_NativeSelect_10bwq_299" data-native-selectcontrol=""><option value="mobile-nav-tab-7-variant-1">Showcase</option><option value="mobile-nav-tab-7-variant-2">Blog</option><option value="mobile-nav-tab-7-variant-3">Cookbook</option><option value="mobile-nav-tab-7-variant-4">Learn</option><option value="mobile-nav-tab-7-variant-5">Community</option></select><span class="_SelectControl_x887o_1" role="button" tabindex="-1" data-variant="outline" data-block="" data-size="3xl" data-selected="true" aria-disabled="false" id="select-trigger-_r115R_0_" aria-labelledby="_r115R_5H1_ _r115R_5_" aria-hidden="true"><span class="_TriggerText_x887o_510"><span id="_r115R_5H1_" class="sr-only w-full h-0 left-0 bottom-0 pointer-events-none">Docs section</span><span id="_r115R_5_">Select...</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 16 9" fill="currentColor" class="_DropdownIcon_x887o_475 _DropdownIconChevron_x887o_586"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"></path></svg></div></span></div></div><!--astro:end--></astro-island> </div>  <div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-0" class="flex flex-col gap-6 astro-3ef6ksr2">  </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-1" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2">  </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-2" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/blog" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> All posts   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Recent </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/blog/custom-code-review-rules-for-codex" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Custom Code Review rules for Codex   </a> </li><li> <a href="/blog/mastering-codex-remote-for-engineering" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Mastering remote engineering work from your phone   </a> </li><li> <a href="/blog/connect-private-mcp-servers-to-openai-products" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Making private MCP servers reachable without making them public   </a> </li><li> <a href="/blog/realtime-perplexity-computer" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> How Perplexity Brought Voice Search to Millions Using the Realtime API   </a> </li><li> <a href="/blog/designing-delightful-frontends-with-gpt-5-4" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Designing delightful frontends with GPT-5.4   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Topics </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/blog/topic/general" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> General   </a> </li><li> <a href="/blog/topic/api" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> API   </a> </li><li> <a href="/blog/topic/apps-sdk" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Apps SDK   </a> </li><li> <a href="/blog/topic/audio" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Audio   </a> </li><li> <a href="/blog/topic/codex" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-3" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/cookbook" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Topics </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/cookbook/topic/agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Agents   </a> </li><li> <a href="/cookbook/topic/evals" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Evals   </a> </li><li> <a href="/cookbook/topic/multimodal" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Multimodal   </a> </li><li> <a href="/cookbook/topic/text" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Text   </a> </li><li> <a href="/cookbook/topic/guardrails" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Guardrails   </a> </li><li> <a href="/cookbook/topic/optimization" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Optimization   </a> </li><li> <a href="/cookbook/topic/chatgpt" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> ChatGPT   </a> </li><li> <a href="/cookbook/topic/codex" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex   </a> </li><li> <a href="/cookbook/topic/gpt-oss" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> gpt-oss   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Contribute </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://github.com/openai/openai-cookbook" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Cookbook on GitHub  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-4" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/learn" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Home   </a> </li><li> <a href="/learn/developers-codex-plugin" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> OpenAI Developers plugin   </a> </li><li> <a href="/learn/docs-mcp" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Docs MCP   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Categories </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/learn/code" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Demo apps   </a> </li><li> <a href="/learn/videos" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Videos   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Topics </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/learn/agents" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Agents   </a> </li><li> <a href="/learn/audio" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Audio &amp; Voice   </a> </li><li> <a href="/learn/cua" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Computer Use   </a> </li><li> <a href="/learn/codex" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex   </a> </li><li> <a href="/learn/evals" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Evals   </a> </li><li> <a href="/learn/gpt-oss" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> gpt-oss   </a> </li><li> <a href="/learn/fine-tuning" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Fine-tuning   </a> </li><li> <a href="/learn/imagegen" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Image generation   </a> </li><li> <a href="/learn/scaling" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Scaling   </a> </li><li> <a href="/learn/tools" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Tools   </a> </li><li> <a href="/learn/videogen" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Video generation   </a> </li> </ul> </div> </div><div data-mobile-nav-variant-content="" data-variant-id="mobile-nav-tab-7-variant-5" hidden="" class="flex flex-col gap-6 astro-3ef6ksr2"> <div class="flex flex-col gap-3 astro-3ef6ksr2">  <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/community" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Community   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Programs </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/community/codex-ambassadors" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex Ambassadors   </a> </li><li> <a href="/community/students" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex for Students   </a> </li><li> <a href="/community/codex-for-oss" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Codex for Open Source   </a> </li><li> <a href="https://openai.com/business/why-openai/startups/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> OpenAI for Startups  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Events </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="/community/meetups" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover " data-mobile-nav-link=""> Meetups   </a> </li> </ul> </div><div class="flex flex-col gap-3 astro-3ef6ksr2"> <h3 class="text-xs tracking-wide text-secondary astro-3ef6ksr2"> Spaces </h3> <ul class="flex flex-col gap-1 text-sm text-default w-full"> <li> <a href="https://community.openai.com/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Developer Forum  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://discord.com/invite/openai" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Discord  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://www.reddit.com/r/OpenAI/" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> Reddit  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li><li> <a href="https://x.com/OpenAIDevs" class="px-3 py-1.5 rounded-lg transition-colors block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-2" target="_blank" rel="noopener noreferrer" data-mobile-nav-link=""> X  <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block ml-1 text-gray-600 dark:text-gray-300 "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg> </a> </li> </ul> </div> </div> </div> </div> <div class="w-full px-6 py-6 border-t border-primary-surface astro-3ef6ksr2" data-mobile-nav-footer=""> <div class="flex flex-col gap-5 astro-3ef6ksr2"> <div data-site-visibility-exclude="chatgpt-docs" class="astro-3ef6ksr2"> <div class="flex items-center gap-2 w-full gap-3 astro-3ef6ksr2"><a target="_blank" rel="noopener noreferrer" href="https://platform.openai.com/login" class="_Button_6dmow_1 not-prose flex-1 justify-center" data-color="primary" data-variant="solid" data-pill="" data-size="md"><span class="_ButtonInner_6dmow_4"><span class="">API Dashboard</span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" data-external-link-indicator="persistent" class="shrink-0"><path fill-rule="evenodd" d="M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z" clip-rule="evenodd"></path></svg></span></a></div> </div><div data-site-visibility-include="chatgpt-docs" class="astro-3ef6ksr2" hidden=""> <div class="flex items-center gap-2 w-full gap-3 astro-3ef6ksr2"><a target="_blank" rel="noopener noreferrer" href="https://chatgpt.com/" class="_Button_6dmow_1 not-prose flex-1 justify-center" data-color="primary" data-variant="solid" data-pill="" data-size="lg"><span class="_ButtonInner_6dmow_4"><span class="">Try ChatGPT</span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" data-external-link-indicator="persistent" class="shrink-0"><path fill-rule="evenodd" d="M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z" clip-rule="evenodd"></path></svg></span></a></div> </div> <div class="flex flex-wrap items-center gap-4 text-sm text-gray-700 dark:text-gray-300 astro-3ef6ksr2">  </div> </div> </div> </div> </div> <script data-astro-exec="">
  document.dispatchEvent(new CustomEvent("site-variant:apply"));
</script>  <script data-astro-exec="">
  const MOBILE_NAV_PERSIST_KEY = "mobile-nav:restore-open";

  const readPersistedMobileNavOpen = () => {
    try {
      return sessionStorage.getItem(MOBILE_NAV_PERSIST_KEY) === "true";
    } catch {
      return false;
    }
  };

  const setPersistedMobileNavOpen = (isOpen) => {
    try {
      if (isOpen) {
        sessionStorage.setItem(MOBILE_NAV_PERSIST_KEY, "true");
      } else {
        sessionStorage.removeItem(MOBILE_NAV_PERSIST_KEY);
      }
    } catch {}
  };

  function initializeMobileNavigation() {
    document.dispatchEvent(new CustomEvent("site-variant:apply"));

    const drawer = document.getElementById("drawer");
    const drawerButton = document.getElementById("header-drawer-button");

    if (
      !drawer ||
      !drawerButton ||
      drawer.dataset.mobileNavInitialized === "true"
    ) {
      return;
    }

    const navTabElements = Array.from(
      drawer.querySelectorAll("[data-mobile-nav-tab]")
    );
    const visibleNavTabElements = navTabElements.filter((tab) => !tab.hidden);
    const defaultSearchPlaceholder =
      drawer.dataset.defaultSearchPlaceholder || "Search the site";
    const defaultSearchScope = drawer.dataset.defaultSearchScope || "";
    const headerSearchOverlay = document.getElementById(
      "header-search-overlay"
    );
    const navLinkElements = Array.from(
      drawer.querySelectorAll("[data-mobile-nav-link]")
    );
    const tabPanels = Array.from(
      drawer.querySelectorAll("[data-mobile-nav-content]")
    );
    const isStarlightApiReferenceRoute =
      window.location.pathname === "/api/reference" ||
      window.location.pathname.startsWith("/api/reference/");
    const shouldRestoreDrawerOpen =
      matchMedia("(max-width: 63.999rem)").matches &&
      !isStarlightApiReferenceRoute &&
      readPersistedMobileNavOpen();

    const configuredDefaultTab = navTabElements.find(
      (tab) => tab.dataset.tabId === drawer.dataset.defaultTabId
    );
    let activeTabId =
      visibleNavTabElements.find((tab) => tab.dataset.isActive === "true")
        ?.dataset.tabId ||
      (!configuredDefaultTab?.hidden
        ? configuredDefaultTab?.dataset.tabId
        : undefined) ||
      visibleNavTabElements[0]?.dataset.tabId ||
      null;

    const updateSelectedOption = (tabId) => {
      let selectedLabel = "";
      let selectedPlaceholder = "";
      let selectedScope = "";

      navTabElements.forEach((tab) => {
        const isSelected = tab.dataset.tabId === tabId;
        tab.dataset.selected = isSelected ? "true" : "false";
        tab.setAttribute("aria-selected", isSelected ? "true" : "false");

        if (isSelected && !selectedLabel) {
          selectedLabel = tab.dataset.label || tab.textContent?.trim() || "";
        }

        if (isSelected && !selectedPlaceholder) {
          selectedPlaceholder = tab.dataset.searchPlaceholder || "";
        }

        if (isSelected && !selectedScope) {
          selectedScope = tab.dataset.searchScope || "";
        }
      });

      if (!selectedLabel && visibleNavTabElements[0]) {
        selectedLabel =
          visibleNavTabElements[0].dataset.label ||
          visibleNavTabElements[0].textContent?.trim() ||
          "";
      }

      if (!selectedPlaceholder && visibleNavTabElements[0]) {
        selectedPlaceholder =
          visibleNavTabElements[0].dataset.searchPlaceholder || "";
      }

      if (!selectedScope && visibleNavTabElements[0]) {
        selectedScope = visibleNavTabElements[0].dataset.searchScope || "";
      }

      const nextPlaceholder = selectedPlaceholder || defaultSearchPlaceholder;
      const nextScope = selectedScope || defaultSearchScope;
      const updatePlaceholder = (container) => {
        if (!container) return;
        const input = container.querySelector("[data-site-search-input]");
        if (input instanceof HTMLInputElement) {
          input.placeholder = nextPlaceholder;
        }
      };
      const updateScope = (container) => {
        if (!container) return;
        const target = container.querySelector("[data-site-search-root]");
        if (!target) return;
        target.setAttribute("data-scope", nextScope);
        target.dispatchEvent(new CustomEvent("site-search:update"));
      };
      updatePlaceholder(drawer);
      updatePlaceholder(headerSearchOverlay);
      updateScope(drawer);
      updateScope(headerSearchOverlay);
    };

    const activeVariantByTabId = new Map();

    const getTabLabel = (tabId) => {
      return (
        navTabElements.find((tab) => tab.dataset.tabId === tabId)?.dataset
          .label || ""
      );
    };

    const updatePanelBreadcrumb = (panel, tabId, contextLabel) => {
      const breadcrumb = panel.querySelector("[data-mobile-breadcrumb]");
      const parent = panel.querySelector("[data-mobile-breadcrumb-parent]");
      const childWrapper = panel.querySelector(
        "[data-mobile-breadcrumb-child-wrapper]"
      );
      const child = panel.querySelector("[data-mobile-breadcrumb-child]");
      const contextOptions = panel.querySelector(
        "[data-mobile-context-options]"
      );

      if (contextOptions) {
        contextOptions.dataset.contextActive = contextLabel ? "true" : "false";
      }

      if (!breadcrumb || !parent || !childWrapper || !child) {
        return;
      }

      const tabLabel = getTabLabel(tabId);
      parent.textContent = tabLabel;

      if (!contextLabel) {
        breadcrumb.setAttribute("hidden", "true");
        childWrapper.setAttribute("hidden", "true");
        child.textContent = "";
        return;
      }

      breadcrumb.removeAttribute("hidden");
      childWrapper.removeAttribute("hidden");
      child.textContent = contextLabel;
    };

    const selectVariantForPanel = (panel, tabId, variantId) => {
      if (!variantId) {
        updatePanelBreadcrumb(panel, tabId, "");
        return;
      }

      const contextOptions = Array.from(
        panel.querySelectorAll("[data-mobile-context-option]")
      );
      const contextSelects = Array.from(
        panel.querySelectorAll("[data-mobile-context-select]")
      );
      let selectedContextLabel = "";

      contextOptions.forEach((option) => {
        const isSelected = option.dataset.contextId === variantId;
        option.dataset.selected = isSelected ? "true" : "false";
        if (isSelected) {
          selectedContextLabel = option.dataset.contextLabel || "";
        }
      });

      contextSelects.forEach((select) => {
        select.dataset.value = variantId;
        select.dispatchEvent(
          new CustomEvent("mobile-context-select-sync", {
            detail: { value: variantId },
          })
        );
      });

      const variantSections = Array.from(
        panel.querySelectorAll("[data-mobile-nav-variant-content]")
      );
      variantSections.forEach((section) => {
        const isSelected = section.dataset.variantId === variantId;
        if (isSelected) {
          section.removeAttribute("hidden");
        } else {
          section.setAttribute("hidden", "true");
        }
      });

      updatePanelBreadcrumb(panel, tabId, selectedContextLabel);
      activeVariantByTabId.set(tabId, variantId);
    };

    const activateTab = (tabId) => {
      if (!tabId) return;
      activeTabId = tabId;
      updateSelectedOption(tabId);

      tabPanels.forEach((panel) => {
        const panelTabId = panel.getAttribute("data-tab-id");
        const isActive = panelTabId === tabId;
        if (isActive) {
          panel.removeAttribute("hidden");
          const defaultVariantId = panel.getAttribute(
            "data-default-variant-id"
          );
          const nextVariantId =
            activeVariantByTabId.get(tabId) ||
            defaultVariantId ||
            panel.querySelector("[data-mobile-nav-variant-content]")?.dataset
              .variantId ||
            "";
          selectVariantForPanel(panel, tabId, nextVariantId);
        } else {
          panel.setAttribute("hidden", "true");
        }
      });
    };

    const closeDrawer = () => {
      drawer.classList.remove("open");
      drawerButton.classList.remove("open");
      drawerButton.setAttribute("aria-expanded", "false");
      setPersistedMobileNavOpen(false);
    };

    const openDrawer = () => {
      drawer.classList.add("open");
      drawerButton.classList.add("open");
      drawerButton.setAttribute("aria-expanded", "true");
      if (activeTabId) {
        activateTab(activeTabId);
      }
    };

    const toggleDrawer = () => {
      if (drawer.classList.contains("open")) {
        closeDrawer();
      } else {
        openDrawer();
      }
    };

    const handleTabSelection = (tab) => {
      const hasNav = tab.dataset.hasNav === "true";
      const href = tab.dataset.href;
      const tabId = tab.dataset.tabId;

      if (!tabId) {
        return;
      }

      if (!hasNav && href) {
        setPersistedMobileNavOpen(true);
        window.location.href = href;
        return;
      }

      activateTab(tabId);
    };

    drawerButton.addEventListener("click", toggleDrawer);

    navTabElements.forEach((tab) => {
      tab.addEventListener("click", () => {
        handleTabSelection(tab);
      });

      tab.addEventListener("keydown", (event) => {
        if (!visibleNavTabElements.length) return;

        const currentIndex = visibleNavTabElements.indexOf(tab);

        if (event.key === "ArrowRight") {
          event.preventDefault();
          const nextIndex = (currentIndex + 1) % visibleNavTabElements.length;
          visibleNavTabElements[nextIndex]?.focus();
        } else if (event.key === "ArrowLeft") {
          event.preventDefault();
          const prevIndex =
            (currentIndex - 1 + visibleNavTabElements.length) %
            visibleNavTabElements.length;
          visibleNavTabElements[prevIndex]?.focus();
        } else if (event.key === "Home") {
          event.preventDefault();
          visibleNavTabElements[0]?.focus();
        } else if (event.key === "End") {
          event.preventDefault();
          visibleNavTabElements[visibleNavTabElements.length - 1]?.focus();
        } else if (
          event.key === "Enter" ||
          event.key === " " ||
          event.key === "Space" ||
          event.key === "Spacebar"
        ) {
          event.preventDefault();
          handleTabSelection(tab);
        } else if (event.key === "Escape") {
          event.preventDefault();
          closeDrawer();
          drawerButton.focus();
        }
      });
    });

    tabPanels.forEach((panel) => {
      const tabId = panel.getAttribute("data-tab-id") || "";
      const contextOptions = Array.from(
        panel.querySelectorAll("[data-mobile-context-option]")
      );

      contextOptions.forEach((option) => {
        option.addEventListener("click", () => {
          const contextHref = option.dataset.contextHref;
          if (
            contextHref &&
            contextHref.startsWith("/api/reference") &&
            tabId
          ) {
            closeDrawer();
            window.location.href = contextHref;
            return;
          }

          const variantId = option.dataset.contextId;
          if (!variantId || !tabId) {
            return;
          }

          selectVariantForPanel(panel, tabId, variantId);
        });
      });

      const contextSelects = Array.from(
        panel.querySelectorAll("[data-mobile-context-select]")
      );
      contextSelects.forEach((select) => {
        select.addEventListener("mobile-context-select-change", (event) => {
          if (!(event instanceof CustomEvent) || !tabId) {
            return;
          }

          const variantId = event.detail?.value;
          if (typeof variantId !== "string") {
            return;
          }

          selectVariantForPanel(panel, tabId, variantId);
        });
      });
    });

    navLinkElements.forEach((link) => {
      link.addEventListener("click", () => {
        closeDrawer();
      });
    });

    const mobileSearch = drawer.querySelector("[data-mobile-search]");
    mobileSearch?.addEventListener("click", (event) => {
      const target = event.target;
      if (target instanceof Element) {
        const anchor = target.closest("a[href]");
        if (anchor) {
          closeDrawer();
        }
      }
    });

    mobileSearch?.addEventListener("focusin", (event) => {
      const target = event.target;
      if (!(target instanceof HTMLInputElement) || target.type !== "text") {
        return;
      }
      closeDrawer();
      window.requestAnimationFrame(() => {
        if (document.activeElement === target) {
          target.blur();
        }
        document.dispatchEvent(
          new CustomEvent("header:open-search", {
            detail: {
              trigger: target,
              variant: "mobile",
            },
          })
        );
      });
    });

    drawer.addEventListener("keydown", (event) => {
      if (event.key === "Escape") {
        closeDrawer();
        drawerButton.focus();
      }
    });

    drawer.dataset.mobileNavInitialized = "true";
    if (activeTabId) {
      activateTab(activeTabId);
    }

    if (shouldRestoreDrawerOpen) {
      openDrawer();
      setPersistedMobileNavOpen(false);
    }
  }

  function initializeHeaderSearch() {
    const overlay = document.getElementById("header-search-overlay");
    if (!overlay) {
      return;
    }

    const getSearchButtons = () =>
      Array.from(document.querySelectorAll("[data-header-search-button]"));

    const closeButtons = overlay.querySelectorAll("[data-header-search-close]");
    const dismissTarget = overlay.querySelector("[data-header-search-dismiss]");
    const panel = overlay.querySelector("[data-header-search-panel]");
    const overlayMobileClass = "header-search-overlay--mobile";
    const panelMobileClass = "header-search-panel--mobile";
    let lastTrigger = null;
    let lastVariant = null;

    const setExpandedState = (isOpen) => {
      const expanded = isOpen ? "true" : "false";
      getSearchButtons().forEach((button) => {
        button.setAttribute("aria-expanded", expanded);
        button.setAttribute("data-active", expanded);
      });
      overlay.dataset.open = expanded;
      overlay.setAttribute("aria-hidden", isOpen ? "false" : "true");
    };

    const focusSearchInput = () => {
      window.requestAnimationFrame(() => {
        const input = overlay.querySelector("[data-site-search-input]");
        if (input) {
          input.focus();
          input.select();
        }
      });
    };

    const openOverlay = (trigger, options = {}) => {
      lastTrigger = trigger ?? document.activeElement;
      const variant = options.variant ?? null;
      lastVariant = typeof variant === "string" ? variant : null;
      overlay.classList.remove("hidden");
      overlay.classList.add("flex");
      const isMobileVariant = lastVariant === "mobile";
      if (isMobileVariant) {
        overlay.dataset.variant = "mobile";
      } else {
        delete overlay.dataset.variant;
      }
      overlay.classList.toggle(overlayMobileClass, isMobileVariant);
      panel?.classList.toggle(panelMobileClass, isMobileVariant);
      document.documentElement.classList.add("has-header-search-open");
      setExpandedState(true);
      focusSearchInput();
    };

    const closeOverlay = () => {
      overlay.classList.add("hidden");
      overlay.classList.remove("flex");
      document.documentElement.classList.remove("has-header-search-open");
      overlay.classList.remove(overlayMobileClass);
      panel?.classList.remove(panelMobileClass);
      delete overlay.dataset.variant;
      setExpandedState(false);
      if (lastTrigger instanceof HTMLElement) {
        if (
          lastVariant === "mobile" &&
          typeof lastTrigger.blur === "function"
        ) {
          lastTrigger.blur();
        } else if (lastVariant !== "mobile") {
          lastTrigger.focus();
        }
      }
      lastTrigger = null;
      lastVariant = null;
    };

    const bindSearchButtons = () => {
      getSearchButtons().forEach((button) => {
        if (button.dataset.searchButtonInitialized === "true") {
          return;
        }

        button.addEventListener("click", (event) => {
          event.preventDefault();
          openOverlay(button);
        });

        button.dataset.searchButtonInitialized = "true";
      });
    };

    if (overlay.dataset.searchInitialized !== "true") {
      closeButtons.forEach((button) => {
        button.addEventListener("click", () => {
          closeOverlay();
        });
      });

      overlay.addEventListener("click", (event) => {
        if (event.target === overlay) {
          closeOverlay();
        }
      });

      dismissTarget?.addEventListener("click", closeOverlay);

      const handleKeydown = (event) => {
        const key = "key" in event ? event.key : undefined;
        const isShortcut =
          !!key &&
          key.toLowerCase() === "k" &&
          (event.metaKey || event.ctrlKey);

        if (isShortcut) {
          event.preventDefault();
          const buttons = getSearchButtons();
          openOverlay(buttons[0] ?? null);
          return;
        }

        if (key === "Escape" && overlay.dataset.open === "true") {
          event.preventDefault();
          closeOverlay();
        }
      };

      document.addEventListener("keydown", handleKeydown);

      document.addEventListener("header:open-search", (event) => {
        const detail =
          event instanceof CustomEvent && typeof event.detail === "object"
            ? event.detail
            : {};
        const trigger =
          detail && detail.trigger instanceof HTMLElement
            ? detail.trigger
            : null;
        openOverlay(trigger, detail);
      });

      document.addEventListener("astro:before-swap", () => {
        if (overlay.dataset.open === "true") {
          closeOverlay();
        }
      });

      overlay.dataset.searchInitialized = "true";
    }

    bindSearchButtons();
  }

  const handleAfterSwap = () => {
    initializeMobileNavigation();
    window.requestAnimationFrame(() => {
      initializeHeaderSearch();
    });
  };

  document.addEventListener("astro:after-swap", handleAfterSwap);
  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", handleAfterSwap, {
      once: true,
    });
  } else {
    handleAfterSwap();
  }
</script> <div data-docs-agent-page="" class="min-h-dvh"> <div class="flex" style="padding-top: var(--docs-header-offset)"> <div class="hidden lg:flex lg:flex-col w-[218px] px-3 pb-6 pt-2 lg:fixed lg:bottom-0 lg:z-40 bg-surface dark:bg-black astro-73gi4scu" style="top: var(--docs-header-offset)" data-left-nav-container=""><nav class="flex-1 overflow-y-auto overflow-x-visible astro-73gi4scu" data-left-nav="" data-left-nav-id="/api/docs" data-left-nav-scroll-initialized="true"><div class="mt-6 astro-73gi4scu"><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <a href="/api/docs" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Home </span>   </a> </li> </ul></div><div class=" astro-73gi4scu"><h3 class="mb-2 ml-3 mt-6 text-sm font-semibold select-none astro-73gi4scu">Get started</h3><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <a href="/api/docs/quickstart" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block bg-primary-ghost-hover "> <span class="line-clamp-2 "> Quickstart </span>   </a> </li><li> <a href="/api/docs/guides/latest-model" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Using GPT-5.6 </span>   </a> </li><li> <a href="/api/docs/concepts" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Key concepts </span>   </a> </li> </ul></div><div class=" astro-73gi4scu"><h3 class="mb-2 ml-3 mt-6 text-sm font-semibold select-none astro-73gi4scu">Core concepts</h3><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <a href="/api/docs/guides/migrate-to-responses" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Responses API </span>   </a> </li><li> <a href="/api/docs/guides/conversation-state" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Conversation state </span>   </a> </li><li> <a href="/api/docs/guides/background" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Background mode </span>   </a> </li><li> <a href="/api/docs/guides/streaming-responses" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Streaming </span>   </a> </li><li> <a href="/api/docs/guides/websocket-mode" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> WebSocket mode </span>   </a> </li><li> <a href="/api/docs/guides/responses-multi-agent" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Multi-agent </span>   </a> </li><li> <a href="/api/docs/guides/webhooks" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Webhooks </span>   </a> </li><li> <a href="/api/docs/guides/file-inputs" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> File inputs </span>   </a> </li><li> <a href="/api/docs/guides/compaction" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Compaction </span>   </a> </li><li> <a href="/api/docs/guides/token-counting" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Counting tokens </span>   </a> </li> </ul></div><div class=" astro-73gi4scu"><h3 class="mb-2 ml-3 mt-6 text-sm font-semibold select-none astro-73gi4scu">SDKs and CLI</h3><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <a href="/api/docs/libraries" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> OpenAI SDK </span>   </a> </li><li> <a href="/api/docs/libraries/openai-cli" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> OpenAI CLI </span>   </a> </li> </ul></div><div class=" astro-73gi4scu"><h3 class="mb-2 ml-3 mt-6 text-sm font-semibold select-none astro-73gi4scu">Resources</h3><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <a href="/api/docs/changelog" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Changelog </span>   </a> </li><li> <a href="/api/docs/deprecations" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Deprecations </span>   </a> </li><li> <a href="/api/docs/supported-countries" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Supported countries </span>   </a> </li><li> <a href="/api/docs/bots" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> OpenAI Crawlers </span>   </a> </li><li> <a href="https://openai.com/policies" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 block hover:text-default hover:bg-primary-ghost-hover flex items-center justify-between gap-1" target="_blank" rel="noopener noreferrer"> <span class="line-clamp-2 min-w-0 flex-1"> Terms and policies </span> <svg data-external-link-indicator="true" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-2 h-2 inline-block shrink-0 text-current "><path d="M10.2426 0.757385C10.7949 0.757385 11.2426 1.2051 11.2426 1.75738V8.82845C11.2426 9.38074 10.7949 9.82845 10.2426 9.82845C9.69035 9.82845 9.24264 9.38074 9.24264 8.82845V4.1716L2.46446 10.9498C2.07394 11.3403 1.44077 11.3403 1.05025 10.9498C0.659724 10.5592 0.659723 9.92608 1.05025 9.53556L7.82842 2.75739H3.17157C2.61928 2.75739 2.17157 2.30967 2.17157 1.75738C2.17157 1.2051 2.61928 0.757385 3.17157 0.757385H10.2426Z" fill="currentColor"></path></svg>  </a> </li> </ul></div><div class=" astro-73gi4scu"><h3 class="mb-2 ml-3 mt-6 text-sm font-semibold select-none astro-73gi4scu">Legacy APIs</h3><ul class="flex flex-col gap-0.25 text-sm text-default w-full"> <li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 flex items-center justify-between hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1 min-w-0 line-clamp-2">Agent Builder</span>  <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block ml-1 text-current transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-0.5 text-sm text-default w-full mb-2 "> <li> <a href="/api/docs/guides/agent-builder" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Overview </span>   </a> </li><li> <a href="/api/docs/guides/agent-builder/migrate-from-agent-builder" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Migration guide </span>   </a> </li><li> <a href="/api/docs/guides/node-reference" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Node reference </span>   </a> </li><li> <a href="/api/docs/guides/agent-builder-safety" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Safety in building agents </span>   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 flex items-center justify-between hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1 min-w-0 line-clamp-2">Evals</span>  <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block ml-1 text-current transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-0.5 text-sm text-default w-full mb-2 "> <li> <a href="/api/docs/guides/evaluation-getting-started" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Getting started </span>   </a> </li><li> <a href="/api/docs/guides/evals" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Working with evals </span>   </a> </li><li> <a href="/api/docs/guides/prompt-optimizer" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Prompt optimizer </span>   </a> </li><li> <a href="/api/docs/guides/external-models" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> External models </span>   </a> </li><li> <a href="/api/docs/guides/evaluation-best-practices" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Best practices </span>   </a> </li><li> <a href="/api/docs/guides/graders" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Graders </span>   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 flex items-center justify-between hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1 min-w-0 line-clamp-2">Fine-tuning</span>  <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block ml-1 text-current transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-0.5 text-sm text-default w-full mb-2 "> <li> <a href="/api/docs/guides/model-optimization" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Optimization cycle </span>   </a> </li><li> <a href="/api/docs/guides/supervised-fine-tuning" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Supervised fine-tuning </span>   </a> </li><li> <a href="/api/docs/guides/vision-fine-tuning" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Vision fine-tuning </span>   </a> </li><li> <a href="/api/docs/guides/direct-preference-optimization" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Direct preference optimization </span>   </a> </li><li> <a href="/api/docs/guides/reinforcement-fine-tuning" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Reinforcement fine-tuning </span>   </a> </li><li> <a href="/api/docs/guides/rft-use-cases" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> RFT use cases </span>   </a> </li><li> <a href="/api/docs/guides/fine-tuning-best-practices" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Best practices </span>   </a> </li> </ul> </details> </li><li> <details class="nav-disclosure"> <summary class="list-none cursor-pointer select-none px-3 py-1.5 w-full rounded-[8px] transition-colors text-default pl-5 flex items-center justify-between hover:text-default hover:bg-primary-ghost-hover"> <span class="flex-1 min-w-0 line-clamp-2">Assistants API</span>  <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="nav-disclosure-chevron w-3 h-3 inline-block ml-1 text-current transition-transform duration-150 " aria-hidden="true"><path d="M8.29289 4.29289C8.68342 3.90237 9.31658 3.90237 9.70711 4.29289L16.7071 11.2929C17.0976 11.6834 17.0976 12.3166 16.7071 12.7071L9.70711 19.7071C9.31658 20.0976 8.68342 20.0976 8.29289 19.7071C7.90237 19.3166 7.90237 18.6834 8.29289 18.2929L14.5858 12L8.29289 5.70711C7.90237 5.31658 7.90237 4.68342 8.29289 4.29289Z" fill="currentColor"></path></svg> </summary> <ul class="mt-1 ml-3 max-w-[calc(100%-theme(spacing.3))] flex flex-col gap-0.5 text-sm text-default w-full mb-2 "> <li> <a href="/api/docs/assistants/migration" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Migration guide </span>   </a> </li><li> <a href="/api/docs/assistants/deep-dive" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Deep dive </span>   </a> </li><li> <a href="/api/docs/assistants/tools" class="px-3 py-1.5 w-full rounded-[8px] transition-colors text-default block hover:text-default hover:bg-primary-ghost-hover "> <span class="line-clamp-2 "> Tools </span>   </a> </li> </ul> </details> </li> </ul></div></nav></div><script data-astro-exec="">
  const NAV_SELECTOR = "nav[data-left-nav]";
  const STORAGE_PREFIX = "left-nav-scroll:";
  const INITIALIZED_ATTRIBUTE = "data-left-nav-scroll-initialized";

  const isStorageAvailable = (() => {
    try {
      const storageKey = `${STORAGE_PREFIX}__test__`;
      sessionStorage.setItem(storageKey, "1");
      sessionStorage.removeItem(storageKey);
      return true;
    } catch (error) {
      return false;
    }
  })();

  const getNav = () => document.querySelector(NAV_SELECTOR);

  const getStorageKey = (nav) =>
    `${STORAGE_PREFIX}${nav.dataset.leftNavId ?? "default"}`;

  const restoreScrollPosition = (nav) => {
    if (!isStorageAvailable) return;
    const storedValue = sessionStorage.getItem(getStorageKey(nav));
    if (storedValue !== null) {
      nav.scrollTop = Number(storedValue);
    }
  };

  const saveScrollPosition = (nav) => {
    if (!isStorageAvailable) return;
    sessionStorage.setItem(getStorageKey(nav), String(nav.scrollTop));
  };

  const setupNav = () => {
    const nav = getNav();
    if (!nav || nav.getAttribute(INITIALIZED_ATTRIBUTE) === "true") return;

    restoreScrollPosition(nav);

    nav.addEventListener(
      "scroll",
      () => {
        saveScrollPosition(nav);
      },
      { passive: true }
    );

    nav.setAttribute(INITIALIZED_ATTRIBUTE, "true");
  };

  const persistScrollPosition = () => {
    const nav = getNav();
    if (!nav) return;
    saveScrollPosition(nav);
  };

  const initialize = () => {
    setupNav();
    const nav = getNav();
    if (!nav) return;
    restoreScrollPosition(nav);
  };

  window.addEventListener("pageshow", initialize);
  document.addEventListener("astro:page-load", initialize);
  document.addEventListener("astro:after-swap", initialize);

  document.addEventListener("astro:before-swap", persistScrollPosition);
  window.addEventListener("beforeunload", persistScrollPosition);

  initialize();
</script> <main class="min-w-0 flex-1 lg:pl-[240px]"> <div class="page-container md:max-w-6xl pb-12 pt-0" data-content-page-container=""> <div class="mx-auto md:w-full grid grid-cols-1 gap-12 max-w-7xl xl:grid-cols-[minmax(0,1fr)_200px]"> <div data-content-page-toc-rail="" class="sticky z-30 hidden min-h-0 w-full self-start pb-6 xl:col-start-2 xl:row-start-1 xl:flex xl:flex-col" style="top: var(--docs-toc-offset); height: fit-content; max-height: calc(100vh - var(--docs-toc-offset))"> <div class="mb-4 shrink-0">  </div> <script data-astro-exec="">window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["click", "input"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs--><astro-island uid="Z1hXqML" data-solid-render-id="s0" component-url="/_astro/TableOfContents.DWG-MkgE.js" component-export="default" renderer-url="/_astro/client.CNnMPaG9.js" props="{&quot;variant&quot;:[0,&quot;static&quot;],&quot;targetSelector&quot;:[0,&quot;#mainContent&quot;],&quot;headingSelector&quot;:[0,&quot;h2&quot;],&quot;class&quot;:[0,&quot;min-h-0 shrink overflow-y-auto pr-1&quot;]}" client="load" opts="{&quot;name&quot;:&quot;TableOfContents&quot;,&quot;value&quot;:true}" await-children=""><nav data-hk="s00000" class="hidden xl:block w-full overflow-y-auto min-h-0 shrink overflow-y-auto pr-1"><div class="relative"><div class="absolute left-0 top-0 bottom-0 w-[2.15px] bg-primary-soft"></div><div class="absolute left-0 w-[2.15px] bg-primary-solid transition-transform duration-200 ease-out" style="transform: translateY(0px); height: 40px;"></div><ul class="relative list-none p-0 m-0 ml-3 [&amp;&gt;*+*]:mt-3"><li data-id="create-and-export-an-api-key" class="leading-5 ml-0"><a href="#create-and-export-an-api-key" class="block text-sm text-default pl-2 transition-colors">Create and export an API key</a></li><li data-id="install-the-openai-sdk-and-run-an-api-call" class="leading-5 ml-0"><a href="#install-the-openai-sdk-and-run-an-api-call" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Install the OpenAI SDK and Run an API Call</a></li><li data-id="add-credits-to-keep-building" class="leading-5 ml-0"><a href="#add-credits-to-keep-building" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Add credits to keep building</a></li><li data-id="analyze-images-and-files" class="leading-5 ml-0"><a href="#analyze-images-and-files" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Analyze images and files</a></li><li data-id="extend-the-model-with-tools" class="leading-5 ml-0"><a href="#extend-the-model-with-tools" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Extend the model with tools</a></li><li data-id="stream-responses-and-build-real-time-apps" class="leading-5 ml-0"><a href="#stream-responses-and-build-real-time-apps" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Stream responses and build real-time apps</a></li><li data-id="build-agents" class="leading-5 ml-0"><a href="#build-agents" class="block text-sm text-tertiary hover:text-secondary pl-2 transition-colors">Build agents</a></li></ul></div></nav><!--astro:end--></astro-island> <div class="mt-4 shrink-0"> <button type="button" class="page-copy-action astro-y3m22efp" data-page-copy-action="" data-page-copy-default-label="Copy Page" data-page-copy-copied-label="Copied"> <span class="page-copy-action__icon page-copy-action__icon--copy astro-y3m22efp" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24" class="astro-y3m22efp "><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 class="page-copy-action__icon page-copy-action__icon--check astro-y3m22efp" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24" class="astro-y3m22efp "><path fill-rule="evenodd" d="M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z" clip-rule="evenodd"></path></svg> </span> <span data-page-copy-label="" class="astro-y3m22efp">Copy Page</span> </button> <script type="module" src="/_astro/PageCopyAction.astro_astro_type_script_index_0_lang.Df1nqr2j.js" data-astro-exec=""></script> </div>  </div> <div class="relative flex flex-col xl:col-start-1 xl:row-start-1">  <div class="flex flex-col gap-8 mb-2"> <div class="w-full max-w-xs xl:hidden mb-6">  </div> <header class="flex flex-col not-prose gap-1 pt-10 lg:pt-20 xl:pt-7 items-start text-left"> <div class="w-full">  </div> <div class="flex flex-wrap items-center gap-3"> <h1 class="heading-2xl md:heading-2xl">Developer quickstart</h1>  </div> <p class="text-lg text-secondary">Take your first steps with the OpenAI API.</p> <div class="w-full"> <div class="flex w-full flex-wrap items-center gap-3 justify-start">   <div class="xl:hidden"> <button type="button" class="page-copy-action astro-y3m22efp" data-page-copy-action="" data-page-copy-default-label="Copy Page" data-page-copy-copied-label="Copied"> <span class="page-copy-action__icon page-copy-action__icon--copy astro-y3m22efp" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24" class="astro-y3m22efp "><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 class="page-copy-action__icon page-copy-action__icon--check astro-y3m22efp" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24" class="astro-y3m22efp "><path fill-rule="evenodd" d="M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z" clip-rule="evenodd"></path></svg> </span> <span data-page-copy-label="" class="astro-y3m22efp">Copy Page</span> </button>  </div> </div> </div> </header>  </div> <article id="mainContent" class="prose prose-content dark:prose-invert max-w-none pt-4 pb-0"> <p>The OpenAI API provides a consistent interface to state-of-the-art AI <a href="/api/docs/models">models</a> for text generation, natural language processing, computer vision, and more. Get started by creating an API Key and running your first API call. Discover how to generate text, analyze images, build agents, and more.</p>
<aside class="not-prose rounded-xl border border-default bg-surface px-5 py-4 my-6"><div class="flex flex-col gap-4 md:flex-row md:items-center md:justify-between"><div><p class="text-sm font-semibold text-emphasis">Build with the OpenAI API in ChatGPT and Codex</p><p class="mt-1 text-sm leading-6 text-secondary">The OpenAI Developers plugin connects ChatGPT and Codex to the OpenAI Platform, follows OpenAI API setup guidance, and creates project API keys when your application needs one.</p></div><a href="/learn/developers-codex-plugin" class="_Button_6dmow_1 not-prose shrink-0" data-color="secondary" data-variant="soft" data-pill="" data-size="lg" target="_blank" rel="noreferrer"><span class="_ButtonInner_6dmow_4">Install the plugin</span></a></div></aside>
<h2 id="create-and-export-an-api-key" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Create and export an API key</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="create-and-export-an-api-key" aria-label="Copy link to create and export an api key" title="Copy link to create and export an api key"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<astro-island uid="2rfwAc" prefix="r193" component-url="/_astro/Button.react.8ehiBWq9.js" component-export="ButtonLink" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;href&quot;:[0,&quot;https://platform.openai.com/api-keys&quot;],&quot;pill&quot;:[0,true],&quot;size&quot;:[0,&quot;sm&quot;],&quot;className&quot;:[0,&quot;mt-2&quot;],&quot;onClick&quot;:[0,null]}" client="load" opts="{&quot;name&quot;:&quot;ButtonLink&quot;,&quot;value&quot;:true}" await-children=""><a target="_blank" rel="noopener noreferrer" href="https://platform.openai.com/api-keys" class="_Button_6dmow_1 not-prose mt-2" data-color="primary" data-variant="solid" data-pill="" data-size="sm"><span class="_ButtonInner_6dmow_4"><astro-slot><p>Create an API Key</p></astro-slot></span></a><!--astro:end--></astro-island>
<p></p>
<p>Before you begin, create an API key in the dashboard, which you’ll use to
securely <a href="/api/docs/api-reference/authentication">access the API</a>. Store the key
in a safe location, like a <a href="https://www.freecodecamp.org/news/how-do-zsh-configuration-files-work/"><code>.zshrc</code>
file</a> or
another text file on your computer. Once you’ve generated an API key, export it
as an <a href="https://en.wikipedia.org/wiki/Environment_variable">environment variable</a>
in your terminal.</p>
<div id="content-switcher-desktop-os" class="content-switcher-root mt-6 astro-cr4aci74" data-content-switcher-root="" data-content-switcher-id="desktop-os" data-content-switcher-initial="macOS" data-content-switcher-value="macOS" data-content-switcher-preserve-hash="true" data-content-switcher-navigation-mode="history" data-content-switcher-query-value-aliases="{}" data-react-hydrated="true"> <div class="content-switcher-selector mb-6 astro-cr4aci74"> <style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script data-astro-exec="">(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event("astro:load"));})();</script><script data-astro-exec="">(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},o=t=>{let[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let p;try{p=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute("props"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(`astro:${c}`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${this.getAttribute("component-url")}`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();</script><astro-island uid="ZTQEG3" prefix="r132" component-url="/_astro/SwitcherSelector.react.Cwe_o7Xe.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;content-switcher-desktop-os&quot;],&quot;id&quot;:[0,&quot;desktop-os&quot;],&quot;options&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;macOS / Linux&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;macOS&quot;]}],[0,{&quot;label&quot;:[0,&quot;Windows&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;windows&quot;]}]]],&quot;initialValue&quot;:[0,&quot;macOS&quot;],&quot;preserveHash&quot;:[0,true],&quot;navigationMode&quot;:[0,&quot;history&quot;],&quot;queryValueAliases&quot;:[0,{}]}" client="load" opts="{&quot;name&quot;:&quot;SwitcherSelector&quot;,&quot;value&quot;:true}" await-children=""><div role="group" dir="ltr" class="_SegmentedControl_16x8u_1" data-size="md" aria-label="Content switcher" tabindex="0" style="outline:none"><div class="_SegmentedControlThumb_16x8u_226" style="width: 119px; transform: translateX(2px); transition: width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="macOS" tabindex="-1" data-radix-collection-item=""><span class="relative">macOS / Linux</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="windows" tabindex="-1" data-radix-collection-item=""><span class="relative">Windows</span></button></div></astro-island> </div> <div class="content-switcher-panes astro-cr4aci74"> <div data-content-switcher-pane="true" data-value="macOS"><div class="hidden">macOS / Linux</div><astro-island uid="Z18R3FU" prefix="r165" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Export an environment variable on macOS or Linux systems&quot;],&quot;code&quot;:[0,&quot;export OPENAI_API_KEY=\&quot;your_api_key_here\&quot;&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;bash&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 _oneliner_1x2h7_162 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Export an environment variable on macOS or Linux systems</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r165R_a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">export</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OPENAI_API_KEY</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"your_api_key_here"</span></span></code></pre></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="windows" hidden=""><div class="hidden">Windows</div><astro-island uid="Z2v3iwO" prefix="r166" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Export an environment variable in PowerShell&quot;],&quot;code&quot;:[0,&quot;setx OPENAI_API_KEY \&quot;your_api_key_here\&quot;&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;bash&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 _oneliner_1x2h7_162 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Export an environment variable in PowerShell</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r166R_a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">setx</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">OPENAI_API_KEY</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"your_api_key_here"</span></span></code></pre></div></div></astro-island></div> </div> <script data-astro-exec="">
    if (!window.__contentSwitcherInit) {
      window.__contentSwitcherInit = true;

      var queryWithinRoot = function (root, selector) {
        if (!root) return [];
        // A guide pane can contain child switchers. Only update elements owned
        // by this root so parent hydration does not reset nested state.
        return Array.from(root.querySelectorAll(selector)).filter(
          function (element) {
            return element.closest("[data-content-switcher-root]") === root;
          }
        );
      };

      var updateButtons = function (root, value) {
        if (!root || !value) return;
        // Avoid mutating React-managed segmented controls before hydration.
        if (!root.hasAttribute("data-react-hydrated")) return;
        var buttons = queryWithinRoot(root, "[data-content-switcher-option]");
        var activeButton = null;
        buttons.forEach(function (button) {
          var isActive = button.dataset.value === value;
          button.setAttribute("data-state", isActive ? "on" : "off");
          button.setAttribute("aria-checked", isActive ? "true" : "false");
          if (isActive) {
            activeButton = button;
          }
        });

        var control = queryWithinRoot(
          root,
          '[role="group"][aria-label="Content switcher"]'
        )[0];
        var thumb = control
          ? control.querySelector('[class*="SegmentedControlThumb"]')
          : null;
        if (thumb && activeButton && control) {
          var targetWidth = Math.floor(activeButton.clientWidth);
          var targetOffset = activeButton.offsetLeft;
          if (control.clientWidth - (targetWidth + targetOffset) < 2) {
            targetWidth = targetWidth - 1;
          }
          thumb.style.width = targetWidth + "px";
          thumb.style.transform = "translateX(" + targetOffset + "px)";
        }
      };

      var refreshToc = function () {
        requestAnimationFrame(function () {
          document.dispatchEvent(new CustomEvent("toc:refresh"));
        });
      };

      var setValue = function (root, value) {
        if (!root || !value) return;
        root.dataset.contentSwitcherValue = value;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        panes.forEach(function (pane) {
          if (pane.dataset.value === value) {
            pane.removeAttribute("hidden");
          } else {
            pane.setAttribute("hidden", "");
          }
        });
        updateButtons(root, value);
        refreshToc();
      };

      var getQueryValue = function (root) {
        if (!root) return null;
        var id = root.dataset.contentSwitcherId;
        if (!id) return null;
        var params = new URLSearchParams(window.location.search);
        var value = params.get(id);
        if (!value) return null;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        var hasMatch = panes.some(function (pane) {
          return pane.dataset.value === value;
        });
        if (hasMatch) return value;

        var aliases = {};
        try {
          aliases = JSON.parse(
            root.dataset.contentSwitcherQueryValueAliases || "{}"
          );
        } catch {
          aliases = {};
        }
        var alias = aliases[value];
        var hasAliasMatch =
          typeof alias === "string" &&
          panes.some(function (pane) {
            return pane.dataset.value === alias;
          });
        return hasAliasMatch ? alias : null;
      };

      var initRoot = function (root) {
        if (!root) return;
        var queryValue = getQueryValue(root);
        var initial = root.dataset.contentSwitcherInitial;
        var nextValue = queryValue || initial;
        if (nextValue) {
          setValue(root, nextValue);
        }
      };

      var navigateBeforeHydration = function (root, value) {
        if (!root || !value || root.hasAttribute("data-react-hydrated")) {
          return false;
        }
        if (root.dataset.contentSwitcherValue === value) return false;

        var id = root.dataset.contentSwitcherId;
        if (!id) return false;

        var url = new URL(window.location.href);
        url.searchParams.set(id, value);
        if (root.dataset.contentSwitcherPreserveHash === "false") {
          url.hash = "";
        }

        if (root.dataset.contentSwitcherNavigationMode === "document") {
          window.location.assign(url.toString());
          return true;
        }

        window.history.pushState({}, "", url);
        window.dispatchEvent(new PopStateEvent("popstate"));
        return false;
      };

      document
        .querySelectorAll("[data-content-switcher-root]")
        .forEach(initRoot);

      document.addEventListener("content-switcher:set", function (event) {
        var detail = event?.detail || {};
        var target = event.target;
        var root =
          target && target.closest
            ? target.closest("[data-content-switcher-root]")
            : null;
        if (!root && detail.id) {
          root = document.querySelector(
            '[data-content-switcher-root][data-content-switcher-id="' +
              detail.id +
              '"]'
          );
        }
        if (root && typeof detail.value === "string") {
          setValue(root, detail.value);
        }
      });

      window.addEventListener("popstate", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });

      document.addEventListener("click", function (event) {
        var target = event.target;
        if (!target || !target.closest) return;
        var button = target.closest("[data-content-switcher-option]");
        if (!button) return;
        var root = button.closest("[data-content-switcher-root]");
        if (!root) return;
        if (root.hasAttribute("data-react-hydrated")) return;
        var value = button.dataset.value;
        if (value) {
          var isDocumentNavigation = navigateBeforeHydration(root, value);
          if (!isDocumentNavigation) {
            setValue(root, value);
          }
        }
      });

      document.addEventListener("astro:page-load", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });
    }
  </script> </div>
<p>Each OpenAI SDK automatically reads your API key from the system environment.</p>
<h2 id="install-the-openai-sdk-and-run-an-api-call" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Install the OpenAI SDK and Run an API Call</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="install-the-openai-sdk-and-run-an-api-call" aria-label="Copy link to install the openai sdk and run an api call" title="Copy link to install the openai sdk and run an api call"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<div id="content-switcher-language" class="content-switcher-root mt-6 astro-cr4aci74" data-content-switcher-root="" data-content-switcher-id="language" data-content-switcher-initial="javascript" data-content-switcher-value="javascript" data-content-switcher-preserve-hash="true" data-content-switcher-navigation-mode="history" data-content-switcher-query-value-aliases="{}" data-react-hydrated="true"> <div class="content-switcher-selector mb-6 astro-cr4aci74"> <astro-island uid="Z1RNLt9" prefix="r133" component-url="/_astro/SwitcherSelector.react.Cwe_o7Xe.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;content-switcher-language&quot;],&quot;id&quot;:[0,&quot;language&quot;],&quot;options&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;JavaScript&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;javascript&quot;]}],[0,{&quot;label&quot;:[0,&quot;Python&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;python&quot;]}],[0,{&quot;label&quot;:[0,&quot;.NET&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;csharp&quot;]}],[0,{&quot;label&quot;:[0,&quot;Java&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;java&quot;]}],[0,{&quot;label&quot;:[0,&quot;Go&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;golang&quot;]}],[0,{&quot;label&quot;:[0,&quot;Ruby&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;ruby&quot;]}]]],&quot;initialValue&quot;:[0,&quot;javascript&quot;],&quot;preserveHash&quot;:[0,true],&quot;navigationMode&quot;:[0,&quot;history&quot;],&quot;queryValueAliases&quot;:[0,{}]}" client="load" opts="{&quot;name&quot;:&quot;SwitcherSelector&quot;,&quot;value&quot;:true}" await-children=""><div role="group" dir="ltr" class="_SegmentedControl_16x8u_1" data-size="md" aria-label="Content switcher" tabindex="0" style="outline:none"><div class="_SegmentedControlThumb_16x8u_226" style="width: 93px; transform: translateX(2px); transition: width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="javascript" tabindex="-1" data-radix-collection-item=""><span class="relative">JavaScript</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="python" tabindex="-1" data-radix-collection-item=""><span class="relative">Python</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="csharp" tabindex="-1" data-radix-collection-item=""><span class="relative">.NET</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="java" tabindex="-1" data-radix-collection-item=""><span class="relative">Java</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="golang" tabindex="-1" data-radix-collection-item=""><span class="relative">Go</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="ruby" tabindex="-1" data-radix-collection-item=""><span class="relative">Ruby</span></button></div></astro-island> </div> <div class="content-switcher-panes astro-cr4aci74"> <div data-content-switcher-pane="true" data-value="javascript"><div class="hidden">JavaScript</div><p>To use the OpenAI API in server-side JavaScript environments like Node.js, Deno, or Bun, you can use the official <a href="https://github.com/openai/openai-node">OpenAI SDK for TypeScript and JavaScript</a>. Get started by installing the SDK using <a href="https://www.npmjs.com/">npm</a> or your preferred package manager:</p>
<astro-island uid="Z13f9D2" prefix="r195" component-url="/_astro/CodeSample.react.ZqsxRRPn.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Install the OpenAI SDK with npm&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;bash&quot;],&quot;code&quot;:[0,&quot;npm install openai&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 _oneliner_1x2h7_162 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Install the OpenAI SDK with npm</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r195R_a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">npm</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">install</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">openai</span></span></code></pre></div></div></astro-island>
<p>With the OpenAI SDK installed, create a file called <code>example.mjs</code> and copy the example code into it:</p>
<astro-island uid="2niIGV" prefix="r196" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst response = await client.responses.create({\n  model: \&quot;{{MODEL}}\&quot;,\n  input: \&quot;Write a one-sentence bedtime story about a unicorn.\&quot;,\n});\n\nconsole.log(response.output_text);&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r196R_a_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Write a one-sentence bedtime story about a unicorn."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div></div></astro-island>
<p>Execute the code with <code>node example.mjs</code> (or the equivalent command for Deno or Bun). In a few moments, you should see the output of your API request.</p>
<a href="https://github.com/openai/openai-node"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Learn more on GitHub</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Discover more SDK capabilities and options on the library’s GitHub README.</p> </div> </div> </div></a></div><div data-content-switcher-pane="true" data-value="python" hidden=""><div class="hidden">Python</div><p>To use the OpenAI API in Python, you can use the official <a href="https://github.com/openai/openai-python">OpenAI SDK for Python</a>. Get started by installing the SDK using <a href="https://pypi.org/project/pip/">pip</a>:</p>
<astro-island uid="SjF1h" prefix="r198" component-url="/_astro/CodeSample.react.ZqsxRRPn.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Install the OpenAI SDK with pip&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;bash&quot;],&quot;code&quot;:[0,&quot;pip install openai&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 _oneliner_1x2h7_162 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Install the OpenAI SDK with pip</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r198R_a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">pip</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">install</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">openai</span></span></code></pre></div></div></astro-island>
<p>With the OpenAI SDK installed, create a file called <code>example.py</code> and copy the example code into it:</p>
<astro-island uid="Zxqk0v" prefix="r199" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;python&quot;],&quot;code&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;{{MODEL}}\&quot;,\n    input=\&quot;Write a one-sentence bedtime story about a unicorn.\&quot;,\n)\n\nprint(response.output_text)&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r199R_a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> openai </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">client </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">response </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#FFAB70;--shiki-light:#E36209">model</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#FFAB70;--shiki-light:#E36209">input</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Write a one-sentence bedtime story about a unicorn."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">print</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text)</span></span></code></pre></div></div></astro-island>
<p>Execute the code with <code>python example.py</code>. In a few moments, you should see the output of your API request.</p>
<a href="https://github.com/openai/openai-python"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Learn more on GitHub</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Discover more SDK capabilities and options on the library’s GitHub README.</p> </div> </div> </div></a></div><div data-content-switcher-pane="true" data-value="csharp" hidden=""><div class="hidden">.NET</div><p>In collaboration with Microsoft, OpenAI provides an officially supported API client for C#. You can install it with the .NET CLI from <a href="https://www.nuget.org/">NuGet</a>.</p>
<pre class="astro-code astro-code-themes github-light github-dark relative" style="background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8;overflow-x:auto" tabindex="0" data-language="plaintext"><code><span class="line"><span>dotnet add package OpenAI</span></span></code><div class="copy-cnt"><button type="button" class="copy-btn" aria-label="Copy code to clipboard"><svg class="copy-svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
    <path fill="currentColor" 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></button><span class="sr-only" role="status" aria-live="polite" aria-atomic="true"></span></div></pre>
<p>A simple API request to the <a href="/api/docs/api-reference/responses">Responses API</a> would look like this:</p>
<astro-island uid="12X8Rn" prefix="r201" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;csharp&quot;],&quot;code&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nResponseResult response = await client.CreateResponseAsync(\n    \&quot;{{MODEL}}\&quot;,\n    \&quot;Say 'this is a test.'\&quot;\n);\n\nConsole.WriteLine($\&quot;[ASSISTANT]: {response.GetOutputText()}\&quot;);&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r201R_a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">using</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">#</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">pragma</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">warning</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">disable</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">string</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">key</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> Environment.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">GetEnvironmentVariable</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"OPENAI_API_KEY"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">!</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">ResponsesClient</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">ResponseResult</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">CreateResponseAsync</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Say 'this is a test.'"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">Console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">WriteLine</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">$"[ASSISTANT]: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">{</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">response</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">GetOutputText</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">()}</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">);</span></span></code></pre></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="java" hidden=""><div class="hidden">Java</div><p>OpenAI provides an API helper for the Java programming language, currently in beta. You can include the Maven dependency using the following configuration:</p>
<pre class="astro-code astro-code-themes github-light github-dark relative" style="background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8;overflow-x:auto" tabindex="0" data-language="xml"><code><span class="line"><span style="color:#24292E;--shiki-dark:#E1E4E8">&lt;</span><span style="color:#22863A;--shiki-dark:#85E89D">dependency</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;</span></span>
<span class="line"><span style="color:#24292E;--shiki-dark:#E1E4E8">  &lt;</span><span style="color:#22863A;--shiki-dark:#85E89D">groupId</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;com.openai&lt;/</span><span style="color:#22863A;--shiki-dark:#85E89D">groupId</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;</span></span>
<span class="line"><span style="color:#24292E;--shiki-dark:#E1E4E8">  &lt;</span><span style="color:#22863A;--shiki-dark:#85E89D">artifactId</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;openai-java&lt;/</span><span style="color:#22863A;--shiki-dark:#85E89D">artifactId</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;</span></span>
<span class="line"><span style="color:#24292E;--shiki-dark:#E1E4E8">  &lt;</span><span style="color:#22863A;--shiki-dark:#85E89D">version</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;4.0.0&lt;/</span><span style="color:#22863A;--shiki-dark:#85E89D">version</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;</span></span>
<span class="line"><span style="color:#24292E;--shiki-dark:#E1E4E8">&lt;/</span><span style="color:#22863A;--shiki-dark:#85E89D">dependency</span><span style="color:#24292E;--shiki-dark:#E1E4E8">&gt;</span></span></code><div class="copy-cnt"><button type="button" class="copy-btn" aria-label="Copy code to clipboard"><svg class="copy-svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
    <path fill="currentColor" 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></button><span class="sr-only" role="status" aria-live="polite" aria-atomic="true"></span></div></pre>
<p>A simple API request to <a href="/api/docs/api-reference/responses">Responses API</a> would look like this:</p>
<astro-island uid="ZzbzY7" prefix="r202" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;java&quot;],&quot;code&quot;:[0,&quot;import com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.responses.Response;\nimport com.openai.models.responses.ResponseCreateParams;\n\npublic class Main {\n  public static void main(String[] args) {\n    OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n    ResponseCreateParams params =\n        ResponseCreateParams.builder().input(\&quot;Say this is a test\&quot;).model(\&quot;{{MODEL}}\&quot;).build();\n\n    Response response = client.responses().create(params);\n    response.output().stream()\n        .flatMap(item -&gt; item.message().stream())\n        .flatMap(message -&gt; message.content().stream())\n        .flatMap(content -&gt; content.outputText().stream())\n        .forEach(outputText -&gt; System.out.println(outputText.text()));\n  }\n}&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r202R_a_" tabindex="0"><code data-1p-ignore="true" data-language="java" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> com.openai.client.OpenAIClient;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> com.openai.client.okhttp.OpenAIOkHttpClient;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> com.openai.models.responses.Response;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> com.openai.models.responses.ResponseCreateParams;</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">public</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">class</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Main</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">public</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">static</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">void</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">main</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">String</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">[] </span><span class="shiki-token" style="--shiki-dark:#FFAB70;--shiki-light:#E36209">args</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">) {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    OpenAIClient client </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAIOkHttpClient.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">fromEnv</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    ResponseCreateParams params </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        ResponseCreateParams.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">builder</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">input</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Say this is a test"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">).</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">model</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">).</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">build</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    Response response </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(params);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    response.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">output</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">stream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        .</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">flatMap</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(item </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">-&gt;</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> item.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">message</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">stream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        .</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">flatMap</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(message </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">-&gt;</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> message.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">content</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">stream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        .</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">flatMap</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(content </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">-&gt;</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> content.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">outputText</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">().</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">stream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        .</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">forEach</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(outputText </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">-&gt;</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> System.out.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">println</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(outputText.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">text</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">()));</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">}</span></span></code></pre></div></div></astro-island>
<p>To learn more about using the OpenAI API in Java, check out the GitHub repo linked below!</p>
<a href="https://github.com/openai/openai-java"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Learn more on GitHub</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Discover more SDK capabilities and options on the library’s GitHub README.</p> </div> </div> </div></a></div><div data-content-switcher-pane="true" data-value="golang" hidden=""><div class="hidden">Go</div><p>OpenAI provides an API helper for the Go programming language, currently in beta. You can import the library using the code below:</p>
<astro-island uid="Z2os97i" prefix="r204" component-url="/_astro/CodeSample.react.ZqsxRRPn.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;highlighted&quot;:[0,true],&quot;code&quot;:[0,&quot;import (\n\t\&quot;github.com/openai/openai-go/v3\&quot; // imported as openai\n)&quot;],&quot;language&quot;:[0,&quot;go&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithCopyFloat_1x2h7_145"><div class="_copyFloat_1x2h7_157"><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r204R_a_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">github.com/openai/openai-go/v3</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#6A737D;--shiki-light:#6A737D">// imported as openai</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span></span></code></pre></div></div></astro-island>
<p>A first API request to the <a href="/api/docs/api-reference/responses">Responses API</a> would look like this:</p>
<astro-island uid="EEa9b" prefix="r205" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;go&quot;],&quot;code&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\n\tresp, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{\n\t\tModel: \&quot;{{MODEL}}\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;Say this is a test\&quot;)},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Println(resp.OutputText())\n}&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r205R_a_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">package</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">context</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">fmt</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">github.com/openai/openai-go/v3</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">github.com/openai/openai-go/v3/responses</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">func</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">main</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	client </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">:=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> openai.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">NewClient</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	resp, err </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">:=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.Responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">New</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(context.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">TODO</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(), </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">ResponseNewParams</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">		Model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">		Input: </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">ResponseNewParamsInputUnion</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">{OfString: openai.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">String</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Say this is a test"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">if</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> err </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">!=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">nil</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">		</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">panic</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(err.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Error</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	}</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">	fmt.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Println</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(resp.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OutputText</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">}</span></span></code></pre></div></div></astro-island>
<p>To learn more about using the OpenAI API in Go, check out the GitHub repo linked below!</p>
<a href="https://github.com/openai/openai-go"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Learn more on GitHub</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Discover more SDK capabilities and options on the library’s GitHub README.</p> </div> </div> </div></a></div><div data-content-switcher-pane="true" data-value="ruby" hidden=""><div class="hidden">Ruby</div><p>To use the OpenAI API in Ruby, you can use the official <a href="https://github.com/openai/openai-ruby">OpenAI SDK for Ruby</a>. Get started by adding the gem to your application:</p>
<astro-island uid="ZCs3n2" prefix="r207" component-url="/_astro/CodeSample.react.ZqsxRRPn.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Install the OpenAI SDK with Bundler&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;ruby&quot;],&quot;code&quot;:[0,&quot;gem \&quot;openai\&quot;&quot;]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 _oneliner_1x2h7_162 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Install the OpenAI SDK with Bundler</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r207R_a_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">gem </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span></span></code></pre></div></div></astro-island>
<p>With the OpenAI SDK installed, create a file called <code>example.rb</code> and copy the example code into it:</p>
<astro-island uid="Z1awfHH" prefix="r208" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Test a basic API request&quot;],&quot;highlighted&quot;:[0,true],&quot;language&quot;:[0,&quot;ruby&quot;],&quot;code&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;{{MODEL}}\&quot;,\n  input: \&quot;Write a one-sentence bedtime story about a unicorn.\&quot;\n)\n\nputs(response.output_text)&quot;],&quot;disableLanguagesSelect&quot;:[0,true]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Test a basic API request</div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r208R_a_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">require</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#FFAB70;--shiki-light:#E36209">openai</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">::</span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">Client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#FFAB70;--shiki-light:#E36209">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> openai.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">model:</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">input:</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Write a one-sentence bedtime story about a unicorn."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">puts</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">output_text</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">)</span></span></code></pre></div></div></astro-island>
<p>Execute the code with <code>ruby example.rb</code>. In a few moments, you should see the output of your API request.</p>
<a href="https://github.com/openai/openai-ruby"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Learn more on GitHub</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Discover more SDK capabilities and options on the library’s GitHub README.</p> </div> </div> </div></a></div> </div> <script data-astro-exec="">
    if (!window.__contentSwitcherInit) {
      window.__contentSwitcherInit = true;

      var queryWithinRoot = function (root, selector) {
        if (!root) return [];
        // A guide pane can contain child switchers. Only update elements owned
        // by this root so parent hydration does not reset nested state.
        return Array.from(root.querySelectorAll(selector)).filter(
          function (element) {
            return element.closest("[data-content-switcher-root]") === root;
          }
        );
      };

      var updateButtons = function (root, value) {
        if (!root || !value) return;
        // Avoid mutating React-managed segmented controls before hydration.
        if (!root.hasAttribute("data-react-hydrated")) return;
        var buttons = queryWithinRoot(root, "[data-content-switcher-option]");
        var activeButton = null;
        buttons.forEach(function (button) {
          var isActive = button.dataset.value === value;
          button.setAttribute("data-state", isActive ? "on" : "off");
          button.setAttribute("aria-checked", isActive ? "true" : "false");
          if (isActive) {
            activeButton = button;
          }
        });

        var control = queryWithinRoot(
          root,
          '[role="group"][aria-label="Content switcher"]'
        )[0];
        var thumb = control
          ? control.querySelector('[class*="SegmentedControlThumb"]')
          : null;
        if (thumb && activeButton && control) {
          var targetWidth = Math.floor(activeButton.clientWidth);
          var targetOffset = activeButton.offsetLeft;
          if (control.clientWidth - (targetWidth + targetOffset) < 2) {
            targetWidth = targetWidth - 1;
          }
          thumb.style.width = targetWidth + "px";
          thumb.style.transform = "translateX(" + targetOffset + "px)";
        }
      };

      var refreshToc = function () {
        requestAnimationFrame(function () {
          document.dispatchEvent(new CustomEvent("toc:refresh"));
        });
      };

      var setValue = function (root, value) {
        if (!root || !value) return;
        root.dataset.contentSwitcherValue = value;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        panes.forEach(function (pane) {
          if (pane.dataset.value === value) {
            pane.removeAttribute("hidden");
          } else {
            pane.setAttribute("hidden", "");
          }
        });
        updateButtons(root, value);
        refreshToc();
      };

      var getQueryValue = function (root) {
        if (!root) return null;
        var id = root.dataset.contentSwitcherId;
        if (!id) return null;
        var params = new URLSearchParams(window.location.search);
        var value = params.get(id);
        if (!value) return null;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        var hasMatch = panes.some(function (pane) {
          return pane.dataset.value === value;
        });
        if (hasMatch) return value;

        var aliases = {};
        try {
          aliases = JSON.parse(
            root.dataset.contentSwitcherQueryValueAliases || "{}"
          );
        } catch {
          aliases = {};
        }
        var alias = aliases[value];
        var hasAliasMatch =
          typeof alias === "string" &&
          panes.some(function (pane) {
            return pane.dataset.value === alias;
          });
        return hasAliasMatch ? alias : null;
      };

      var initRoot = function (root) {
        if (!root) return;
        var queryValue = getQueryValue(root);
        var initial = root.dataset.contentSwitcherInitial;
        var nextValue = queryValue || initial;
        if (nextValue) {
          setValue(root, nextValue);
        }
      };

      var navigateBeforeHydration = function (root, value) {
        if (!root || !value || root.hasAttribute("data-react-hydrated")) {
          return false;
        }
        if (root.dataset.contentSwitcherValue === value) return false;

        var id = root.dataset.contentSwitcherId;
        if (!id) return false;

        var url = new URL(window.location.href);
        url.searchParams.set(id, value);
        if (root.dataset.contentSwitcherPreserveHash === "false") {
          url.hash = "";
        }

        if (root.dataset.contentSwitcherNavigationMode === "document") {
          window.location.assign(url.toString());
          return true;
        }

        window.history.pushState({}, "", url);
        window.dispatchEvent(new PopStateEvent("popstate"));
        return false;
      };

      document
        .querySelectorAll("[data-content-switcher-root]")
        .forEach(initRoot);

      document.addEventListener("content-switcher:set", function (event) {
        var detail = event?.detail || {};
        var target = event.target;
        var root =
          target && target.closest
            ? target.closest("[data-content-switcher-root]")
            : null;
        if (!root && detail.id) {
          root = document.querySelector(
            '[data-content-switcher-root][data-content-switcher-id="' +
              detail.id +
              '"]'
          );
        }
        if (root && typeof detail.value === "string") {
          setValue(root, detail.value);
        }
      });

      window.addEventListener("popstate", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });

      document.addEventListener("click", function (event) {
        var target = event.target;
        if (!target || !target.closest) return;
        var button = target.closest("[data-content-switcher-option]");
        if (!button) return;
        var root = button.closest("[data-content-switcher-root]");
        if (!root) return;
        if (root.hasAttribute("data-react-hydrated")) return;
        var value = button.dataset.value;
        if (value) {
          var isDocumentNavigation = navigateBeforeHydration(root, value);
          if (!isDocumentNavigation) {
            setValue(root, value);
          }
        }
      });

      document.addEventListener("astro:page-load", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });
    }
  </script> </div>
<a href="https://github.com/openai/openai-responses-starter-app" target="_blank" rel="noreferrer"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Responses starter app</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Start building with the Responses API.</p> </div> </div> </div></a>
<a href="/api/docs/guides/text" to="/api/docs/guides/text" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12 4.5C7.5271 4.5 4 7.91095 4 12C4 13.6958 4.5996 15.263 5.62036 16.5254C5.80473 16.7534 5.87973 17.0509 5.82551 17.339C5.72928 17.8505 5.60336 18.3503 5.45668 18.8401C6.08722 18.743 6.69878 18.6098 7.2983 18.4395C7.54758 18.3687 7.81461 18.3975 8.04312 18.5197C9.20727 19.1423 10.5566 19.5 12 19.5C16.4729 19.5 20 16.0891 20 12C20 7.91095 16.4729 4.5 12 4.5ZM2 12C2 6.70021 6.53177 2.5 12 2.5C17.4682 2.5 22 6.70021 22 12C22 17.2998 17.4682 21.5 12 21.5C10.3694 21.5 8.82593 21.1286 7.46141 20.4675C6.36717 20.7507 5.2423 20.9253 4.06155 20.9981C3.72191 21.019 3.39493 20.8658 3.19366 20.5915C2.9924 20.3171 2.94448 19.9592 3.06647 19.6415C3.35663 18.8859 3.6004 18.1448 3.77047 17.399C2.65693 15.8695 2 14.0088 2 12Z" fill="currentColor"></path><path d="M9.25 12C9.25 12.6904 8.69036 13.25 8 13.25C7.30964 13.25 6.75 12.6904 6.75 12C6.75 11.3096 7.30964 10.75 8 10.75C8.69036 10.75 9.25 11.3096 9.25 12Z" fill="currentColor"></path><path d="M13.25 12C13.25 12.6904 12.6904 13.25 12 13.25C11.3096 13.25 10.75 12.6904 10.75 12C10.75 11.3096 11.3096 10.75 12 10.75C12.6904 10.75 13.25 11.3096 13.25 12Z" fill="currentColor"></path><path d="M17.25 12C17.25 12.6904 16.6904 13.25 16 13.25C15.3096 13.25 14.75 12.6904 14.75 12C14.75 11.3096 15.3096 10.75 16 10.75C16.6904 10.75 17.25 11.3096 17.25 12Z" fill="currentColor"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Text generation and prompting</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn more about prompting, message roles, and building conversational apps.</p> </div> </div> </div></a>
<h2 id="add-credits-to-keep-building" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Add credits to keep building</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="add-credits-to-keep-building" aria-label="Copy link to add credits to keep building" title="Copy link to add credits to keep building"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<astro-island uid="ZVeM5Y" prefix="r194" component-url="/_astro/Button.react.8ehiBWq9.js" component-export="ButtonLink" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;href&quot;:[0,&quot;https://platform.openai.com/account/billing/overview&quot;],&quot;pill&quot;:[0,true],&quot;size&quot;:[0,&quot;sm&quot;],&quot;className&quot;:[0,&quot;mt-2&quot;],&quot;onClick&quot;:[0,null]}" client="load" opts="{&quot;name&quot;:&quot;ButtonLink&quot;,&quot;value&quot;:true}" await-children=""><a target="_blank" rel="noopener noreferrer" href="https://platform.openai.com/account/billing/overview" class="_Button_6dmow_1 not-prose mt-2" data-color="primary" data-variant="solid" data-pill="" data-size="sm"><span class="_ButtonInner_6dmow_4"><astro-slot><p>Go to billing</p></astro-slot></span></a></astro-island>

<div class="mt-2">Congrats on running a free test API request! Start building real applications with higher limits and use <a href="/api/docs/models" target="_blank">our models</a> to generate text, audio, images, videos and more.</div>
<div class="mt-2"><p>Explore tools and docs designed to help you ship faster:</p></div>
<a href="https://platform.openai.com/chat" target="_blank" rel="noreferrer" onclick="() =&gt; StatsigClient.logEvent(&quot;quickstart_add_credits_chat_playground_click&quot;, null, null)"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12 4.5C7.5271 4.5 4 7.91095 4 12C4 13.6958 4.5996 15.263 5.62036 16.5254C5.80473 16.7534 5.87973 17.0509 5.82551 17.339C5.72928 17.8505 5.60336 18.3503 5.45668 18.8401C6.08722 18.743 6.69878 18.6098 7.2983 18.4395C7.54758 18.3687 7.81461 18.3975 8.04312 18.5197C9.20727 19.1423 10.5566 19.5 12 19.5C16.4729 19.5 20 16.0891 20 12C20 7.91095 16.4729 4.5 12 4.5ZM2 12C2 6.70021 6.53177 2.5 12 2.5C17.4682 2.5 22 6.70021 22 12C22 17.2998 17.4682 21.5 12 21.5C10.3694 21.5 8.82593 21.1286 7.46141 20.4675C6.36717 20.7507 5.2423 20.9253 4.06155 20.9981C3.72191 21.019 3.39493 20.8658 3.19366 20.5915C2.9924 20.3171 2.94448 19.9592 3.06647 19.6415C3.35663 18.8859 3.6004 18.1448 3.77047 17.399C2.65693 15.8695 2 14.0088 2 12Z" fill="currentColor"></path><path d="M9.25 12C9.25 12.6904 8.69036 13.25 8 13.25C7.30964 13.25 6.75 12.6904 6.75 12C6.75 11.3096 7.30964 10.75 8 10.75C8.69036 10.75 9.25 11.3096 9.25 12Z" fill="currentColor"></path><path d="M13.25 12C13.25 12.6904 12.6904 13.25 12 13.25C11.3096 13.25 10.75 12.6904 10.75 12C10.75 11.3096 11.3096 10.75 12 10.75C12.6904 10.75 13.25 11.3096 13.25 12Z" fill="currentColor"></path><path d="M17.25 12C17.25 12.6904 16.6904 13.25 16 13.25C15.3096 13.25 14.75 12.6904 14.75 12C14.75 11.3096 15.3096 10.75 16 10.75C16.6904 10.75 17.25 11.3096 17.25 12Z" fill="currentColor"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Chat Playground</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Build &amp; test conversational prompts and embed them in your app.</p> </div> </div> </div></a>
<a href="/api/docs/guides/agents" to="/api/docs/guides/agents" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M11 7.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM14.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path fill-rule="evenodd" d="M12 1a1 1 0 0 1 1 1v.5h4a3 3 0 0 1 3 3V9a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V5.5a3 3 0 0 1 3-3h4V2a1 1 0 0 1 1-1ZM7 4.5h10a1 1 0 0 1 1 1V9a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V5.5a1 1 0 0 1 1-1Z" clip-rule="evenodd"></path><path d="M6 21c0-.974.551-1.95 1.632-2.722C8.71 17.508 10.252 17 12 17c1.749 0 3.29.508 4.369 1.278C17.449 19.05 18 20.026 18 21a1 1 0 1 0 2 0c0-1.788-1.016-3.311-2.469-4.35-1.455-1.038-3.414-1.65-5.53-1.65-2.118 0-4.077.611-5.532 1.65C5.016 17.69 4 19.214 4 21a1 1 0 1 0 2 0Z"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Build agents</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Use the Agents SDK to build, run, and observe agent workflows.</p> </div> </div> </div></a>
<h2 id="analyze-images-and-files" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Analyze images and files</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="analyze-images-and-files" aria-label="Copy link to analyze images and files" title="Copy link to analyze images and files"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<p>Send image URLs, uploaded files, or PDF documents directly to the model to extract text, classify content, or detect visual elements.</p>
<div id="content-switcher-input-type" class="content-switcher-root mt-6 astro-cr4aci74" data-content-switcher-root="" data-content-switcher-id="input-type" data-content-switcher-initial="image-url" data-content-switcher-value="image-url" data-content-switcher-preserve-hash="true" data-content-switcher-navigation-mode="history" data-content-switcher-query-value-aliases="{}" data-react-hydrated="true"> <div class="content-switcher-selector mb-6 astro-cr4aci74"> <astro-island uid="Z1rBMNt" prefix="r138" component-url="/_astro/SwitcherSelector.react.Cwe_o7Xe.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;content-switcher-input-type&quot;],&quot;id&quot;:[0,&quot;input-type&quot;],&quot;options&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Image URL&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;image-url&quot;]}],[0,{&quot;label&quot;:[0,&quot;File URL&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;file-url&quot;]}],[0,{&quot;label&quot;:[0,&quot;Upload file&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;file-upload&quot;]}]]],&quot;initialValue&quot;:[0,&quot;image-url&quot;],&quot;preserveHash&quot;:[0,true],&quot;navigationMode&quot;:[0,&quot;history&quot;],&quot;queryValueAliases&quot;:[0,{}]}" client="load" opts="{&quot;name&quot;:&quot;SwitcherSelector&quot;,&quot;value&quot;:true}" await-children=""><div role="group" dir="ltr" class="_SegmentedControl_16x8u_1" data-size="md" aria-label="Content switcher" tabindex="0" style="outline:none"><div class="_SegmentedControlThumb_16x8u_226" style="width: 96px; transform: translateX(2px); transition: width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="image-url" tabindex="-1" data-radix-collection-item=""><span class="relative">Image URL</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="file-url" tabindex="-1" data-radix-collection-item=""><span class="relative">File URL</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="file-upload" tabindex="-1" data-radix-collection-item=""><span class="relative">Upload file</span></button></div></astro-island> </div> <div class="content-switcher-panes astro-cr4aci74"> <div data-content-switcher-pane="true" data-value="image-url"><div class="hidden">Image URL</div><astro-island uid="ZYzIMV" prefix="r171" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Analyze the content of an image&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst response = await client.responses.create({\n  model: \&quot;{{MODEL}}\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {\n          type: \&quot;input_text\&quot;,\n          text: \&quot;What is in this image?\&quot;,\n        },\n        {\n          type: \&quot;input_image\&quot;,\n          image_url:\n            \&quot;https://openai-documentation.vercel.app/images/cat_and_otter.png\&quot;,\n          detail: \&quot;auto\&quot;,\n        },\n      ],\n    },\n  ],\n});\n\nconsole.log(response.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;{{MODEL}}\&quot;,\n    input=[\n        {\n            \&quot;role\&quot;: \&quot;user\&quot;,\n            \&quot;content\&quot;: [\n                {\n                    \&quot;type\&quot;: \&quot;input_text\&quot;,\n                    \&quot;text\&quot;: \&quot;What teams are playing in this image?\&quot;,\n                },\n                {\n                    \&quot;type\&quot;: \&quot;input_image\&quot;,\n                    \&quot;image_url\&quot;: \&quot;https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg\&quot;,\n                },\n            ],\n        }\n    ],\n)\n\nprint(response.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;{{MODEL}}\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{\n\t\t\tresponses.ResponseInputItemParamOfMessage(\n\t\t\t\tresponses.ResponseInputMessageContentListParam{\n\t\t\t\t\tresponses.ResponseInputContentParamOfInputText(\&quot;What is in this image?\&quot;),\n\t\t\t\t\t{OfInputImage: &amp;responses.ResponseInputImageParam{\n\t\t\t\t\t\tDetail:   responses.ResponseInputImageDetailAuto,\n\t\t\t\t\t\tImageURL: openai.String(\&quot;https://openai-documentation.vercel.app/images/cat_and_otter.png\&quot;),\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\tresponses.EasyInputMessageRoleUser,\n\t\t\t),\n\t\t}},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nUri imageUrl = new(\n    \&quot;https://openai-documentation.vercel.app/images/cat_and_otter.png\&quot;\n);\n\nResponseResult response = await client.CreateResponseAsync(\n    \&quot;{{MODEL}}\&quot;,\n    [\n        ResponseItem.CreateUserMessageItem(\n            [\n                ResponseContentPart.CreateInputTextPart(\&quot;What is in this image?\&quot;),\n                ResponseContentPart.CreateInputImagePart(imageUrl),\n            ]\n        ),\n    ]\n);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;{{MODEL}}\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {\n          type: \&quot;input_text\&quot;,\n          text: \&quot;What teams are playing in this image?\&quot;\n        },\n        {\n          type: \&quot;input_image\&quot;,\n          image_url: \&quot;https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg\&quot;\n        }\n      ]\n    }\n  ]\n)\n\nputs(response.output_text)&quot;],&quot;curl&quot;:[0,&quot;curl \&quot;https://api.openai.com/v1/responses\&quot; \\\n    -H \&quot;Content-Type: application/json\&quot; \\\n    -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n    -d '{\n        \&quot;model\&quot;: \&quot;{{MODEL}}\&quot;,\n        \&quot;input\&quot;: [\n            {\n                \&quot;role\&quot;: \&quot;user\&quot;,\n                \&quot;content\&quot;: [\n                    {\n                        \&quot;type\&quot;: \&quot;input_text\&quot;,\n                        \&quot;text\&quot;: \&quot;What is in this image?\&quot;\n                    },\n                    {\n                        \&quot;type\&quot;: \&quot;input_image\&quot;,\n                        \&quot;image_url\&quot;: \&quot;https://openai-documentation.vercel.app/images/cat_and_otter.png\&quot;\n                    }\n                ]\n            }\n        ]\n}'&quot;],&quot;cli&quot;:[0,&quot;openai responses create \\\n  --model {{MODEL}} \\\n  --raw-output \\\n  --transform 'output.#(type==\&quot;message\&quot;).content.0.text' &lt;&lt;'YAML'\ninput:\n  - role: user\n    content:\n      - type: input_text\n        text: What is in this image?\n      - type: input_image\n        image_url: https://openai-documentation.vercel.app/images/cat_and_otter.png\nYAML&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Analyze the content of an image</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r171R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r171R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r171R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      role: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_text"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          text: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"What is in this image?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_image"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          image_url:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">            </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"https://openai-documentation.vercel.app/images/cat_and_otter.png"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          detail: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"auto"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "text": "What teams are playing in this image?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_image",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "image_url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			responses.ResponseInputItemParamOfMessage(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				responses.ResponseInputMessageContentListParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					responses.ResponseInputContentParamOfInputText("What is in this image?"),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					{OfInputImage: &amp;responses.ResponseInputImageParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						Detail:   responses.ResponseInputImageDetailAuto,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						ImageURL: openai.String("https://openai-documentation.vercel.app/images/cat_and_otter.png"),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					}},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				responses.EasyInputMessageRoleUser,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		}},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Uri imageUrl = new(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "https://openai-documentation.vercel.app/images/cat_and_otter.png"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ResponseItem.CreateUserMessageItem(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputTextPart("What is in this image?"),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputImagePart(imageUrl),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      role: "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          type: "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          text: "What teams are playing in this image?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          type: "input_image",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          image_url: "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl "https://api.openai.com/v1/responses" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "input": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "text": "What is in this image?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_image",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}'</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r171R_3q_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12</span></span><span class="syntax-highlighter-line"><span class="shiki-token">openai responses create \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --model gpt-5.6 \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --raw-output \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --transform 'output.#(type=="message").content.0.text' &lt;&lt;'YAML'</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">input:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  - role: user</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    content:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      - type: input_text</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        text: What is in this image?</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      - type: input_image</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        image_url: https://openai-documentation.vercel.app/images/cat_and_otter.png</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">YAML</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="file-url" hidden=""><div class="hidden">File URL</div><astro-island uid="Ne5kY" prefix="r172" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Use a file URL as input&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst response = await client.responses.create({\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {\n          type: \&quot;input_text\&quot;,\n          text: \&quot;Analyze the letter and provide a summary of the key points.\&quot;,\n        },\n        {\n          type: \&quot;input_file\&quot;,\n          file_url: \&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;,\n        },\n      ],\n    },\n  ],\n});\n\nconsole.log(response.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;gpt-5.6\&quot;,\n    input=[\n        {\n            \&quot;role\&quot;: \&quot;user\&quot;,\n            \&quot;content\&quot;: [\n                {\n                    \&quot;type\&quot;: \&quot;input_text\&quot;,\n                    \&quot;text\&quot;: \&quot;Analyze the letter and provide a summary of the key points.\&quot;,\n                },\n                {\n                    \&quot;type\&quot;: \&quot;input_file\&quot;,\n                    \&quot;file_url\&quot;: \&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;,\n                },\n            ],\n        },\n    ],\n)\n\nprint(response.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;gpt-5.6\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{\n\t\t\tOfInputItemList: responses.ResponseInputParam{\n\t\t\t\tresponses.ResponseInputItemParamOfMessage(\n\t\t\t\t\tresponses.ResponseInputMessageContentListParam{\n\t\t\t\t\t\tresponses.ResponseInputContentParamOfInputText(\n\t\t\t\t\t\t\t\&quot;Analyze the letter and provide a summary of the key points.\&quot;,\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tOfInputFile: &amp;responses.ResponseInputFileParam{\n\t\t\t\t\t\t\t\tFileURL: openai.String(\n\t\t\t\t\t\t\t\t\t\&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tresponses.EasyInputMessageRoleUser,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nUri fileUrl = new(\n    \&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;\n);\n\nResponseResult response = await client.CreateResponseAsync(\n    \&quot;gpt-5.6\&quot;,\n    [\n        ResponseItem.CreateUserMessageItem(\n            [\n                ResponseContentPart.CreateInputTextPart(\n                    \&quot;Analyze the letter and provide a summary of the key points.\&quot;\n                ),\n                ResponseContentPart.CreateInputFilePart(fileUrl),\n            ]\n        ),\n    ]\n);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {\n          type: \&quot;input_text\&quot;,\n          text: \&quot;Analyze the letter and provide a summary of the key points.\&quot;\n        },\n        {\n          type: \&quot;input_file\&quot;,\n          file_url: \&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;\n        }\n      ]\n    }\n  ]\n)\n\nputs(response.output_text)&quot;],&quot;curl&quot;:[0,&quot;curl \&quot;https://api.openai.com/v1/responses\&quot; \\\n    -H \&quot;Content-Type: application/json\&quot; \\\n    -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n    -d '{\n        \&quot;model\&quot;: \&quot;gpt-5.6\&quot;,\n        \&quot;input\&quot;: [\n            {\n                \&quot;role\&quot;: \&quot;user\&quot;,\n                \&quot;content\&quot;: [\n                    {\n                        \&quot;type\&quot;: \&quot;input_text\&quot;,\n                        \&quot;text\&quot;: \&quot;Analyze the letter and provide a summary of the key points.\&quot;\n                    },\n                    {\n                        \&quot;type\&quot;: \&quot;input_file\&quot;,\n                        \&quot;file_url\&quot;: \&quot;https://www.berkshirehathaway.com/letters/2024ltr.pdf\&quot;\n                    }\n                ]\n            }\n        ]\n    }'&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Use a file URL as input</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r172R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r172R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r172R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      role: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_text"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          text: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Analyze the letter and provide a summary of the key points."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_file"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          file_url: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"https://www.berkshirehathaway.com/letters/2024ltr.pdf"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "text": "Analyze the letter and provide a summary of the key points.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_file",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33<!-- -->
</span><span class="syntax-highlighter-line-number">34<!-- -->
</span><span class="syntax-highlighter-line-number">35<!-- -->
</span><span class="syntax-highlighter-line-number">36<!-- -->
</span><span class="syntax-highlighter-line-number">37<!-- -->
</span><span class="syntax-highlighter-line-number">38<!-- -->
</span><span class="syntax-highlighter-line-number">39<!-- -->
</span><span class="syntax-highlighter-line-number">40<!-- -->
</span><span class="syntax-highlighter-line-number">41</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			OfInputItemList: responses.ResponseInputParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				responses.ResponseInputItemParamOfMessage(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					responses.ResponseInputMessageContentListParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						responses.ResponseInputContentParamOfInputText(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							"Analyze the letter and provide a summary of the key points.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							OfInputFile: &amp;responses.ResponseInputFileParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">								FileURL: openai.String(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">									"https://www.berkshirehathaway.com/letters/2024ltr.pdf",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">								),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					responses.EasyInputMessageRoleUser,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Uri fileUrl = new(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "https://www.berkshirehathaway.com/letters/2024ltr.pdf"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ResponseItem.CreateUserMessageItem(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputTextPart(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "Analyze the letter and provide a summary of the key points."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputFilePart(fileUrl),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      role: "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          type: "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          text: "Analyze the letter and provide a summary of the key points."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          type: "input_file",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r172R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl "https://api.openai.com/v1/responses" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "input": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "text": "Analyze the letter and provide a summary of the key points."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_file",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }'</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="file-upload" hidden=""><div class="hidden">Upload file</div><astro-island uid="ZGM9Ju" prefix="r173" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Upload a file and use it as input&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import fs from \&quot;fs\&quot;;\nimport OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst file = await client.files.create({\n  file: fs.createReadStream(\&quot;fixtures/draconomicon.pdf\&quot;),\n  purpose: \&quot;user_data\&quot;,\n});\n\nconst response = await client.responses.create({\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {\n          type: \&quot;input_file\&quot;,\n          file_id: file.id,\n        },\n        {\n          type: \&quot;input_text\&quot;,\n          text: \&quot;What is the first dragon in the book?\&quot;,\n        },\n      ],\n    },\n  ],\n});\n\nconsole.log(response.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nfile = client.files.create(file=open(\&quot;draconomicon.pdf\&quot;, \&quot;rb\&quot;), purpose=\&quot;user_data\&quot;)\n\nresponse = client.responses.create(\n    model=\&quot;gpt-5.6\&quot;,\n    input=[\n        {\n            \&quot;role\&quot;: \&quot;user\&quot;,\n            \&quot;content\&quot;: [\n                {\n                    \&quot;type\&quot;: \&quot;input_file\&quot;,\n                    \&quot;file_id\&quot;: file.id,\n                },\n                {\n                    \&quot;type\&quot;: \&quot;input_text\&quot;,\n                    \&quot;text\&quot;: \&quot;What is the first dragon in the book?\&quot;,\n                },\n            ],\n        }\n    ],\n)\n\nprint(response.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\t\&quot;os\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\n\tfile, err := os.Open(\&quot;draconomicon.pdf\&quot;)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\tuploadedFile, err := client.Files.New(context.Background(), openai.FileNewParams{\n\t\tFile:    file,\n\t\tPurpose: openai.FilePurposeUserData,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;gpt-5.6\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{\n\t\t\tOfInputItemList: responses.ResponseInputParam{\n\t\t\t\tresponses.ResponseInputItemParamOfMessage(\n\t\t\t\t\tresponses.ResponseInputMessageContentListParam{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tOfInputFile: &amp;responses.ResponseInputFileParam{\n\t\t\t\t\t\t\t\tFileID: openai.String(uploadedFile.ID),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresponses.ResponseInputContentParamOfInputText(\n\t\t\t\t\t\t\t\&quot;What is the first dragon in the book?\&quot;,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tresponses.EasyInputMessageRoleUser,\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Files;\nusing OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nOpenAIFileClient files = new(key);\n\nOpenAIFile file = await files.UploadFileAsync(\n    \&quot;draconomicon.pdf\&quot;,\n    FileUploadPurpose.UserData\n);\n\nResponseResult response = await client.CreateResponseAsync(\n    \&quot;gpt-5.6\&quot;,\n    [\n        ResponseItem.CreateUserMessageItem(\n            [\n                ResponseContentPart.CreateInputFilePart(file.Id),\n                ResponseContentPart.CreateInputTextPart(\n                    \&quot;What is the first dragon in the book?\&quot;\n                ),\n            ]\n        ),\n    ]\n);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nfile = openai.files.create(\n  file: File.open(\&quot;draconomicon.pdf\&quot;, \&quot;rb\&quot;),\n  purpose: \&quot;user_data\&quot;\n)\n\nresponse = openai.responses.create(\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: [\n        {type: \&quot;input_file\&quot;, file_id: file.id},\n        {type: \&quot;input_text\&quot;, text: \&quot;What is the first dragon in the book?\&quot;}\n      ]\n    }\n  ]\n)\n\nputs(response.output_text)&quot;],&quot;curl&quot;:[0,&quot;curl https://api.openai.com/v1/files \\\n    -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n    -F purpose=\&quot;user_data\&quot; \\\n    -F file=\&quot;@draconomicon.pdf\&quot;\n\ncurl \&quot;https://api.openai.com/v1/responses\&quot; \\\n    -H \&quot;Content-Type: application/json\&quot; \\\n    -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n    -d '{\n        \&quot;model\&quot;: \&quot;gpt-5.6\&quot;,\n        \&quot;input\&quot;: [\n            {\n                \&quot;role\&quot;: \&quot;user\&quot;,\n                \&quot;content\&quot;: [\n                    {\n                        \&quot;type\&quot;: \&quot;input_file\&quot;,\n                        \&quot;file_id\&quot;: \&quot;file-6F2ksmvXxt4VdoqmHRw6kL\&quot;\n                    },\n                    {\n                        \&quot;type\&quot;: \&quot;input_text\&quot;,\n                        \&quot;text\&quot;: \&quot;What is the first dragon in the book?\&quot;\n                    }\n                ]\n            }\n        ]\n    }'&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Upload a file and use it as input</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r173R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r173R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r173R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> fs </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"fs"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">file</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.files.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  file: fs.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">createReadStream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"fixtures/draconomicon.pdf"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  purpose: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user_data"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      role: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_file"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          file_id: file.id,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"input_text"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          text: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"What is the first dragon in the book?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">file = client.files.create(file=open("draconomicon.pdf", "rb"), purpose="user_data")</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_file",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "file_id": file.id,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "text": "What is the first dragon in the book?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33<!-- -->
</span><span class="syntax-highlighter-line-number">34<!-- -->
</span><span class="syntax-highlighter-line-number">35<!-- -->
</span><span class="syntax-highlighter-line-number">36<!-- -->
</span><span class="syntax-highlighter-line-number">37<!-- -->
</span><span class="syntax-highlighter-line-number">38<!-- -->
</span><span class="syntax-highlighter-line-number">39<!-- -->
</span><span class="syntax-highlighter-line-number">40<!-- -->
</span><span class="syntax-highlighter-line-number">41<!-- -->
</span><span class="syntax-highlighter-line-number">42<!-- -->
</span><span class="syntax-highlighter-line-number">43<!-- -->
</span><span class="syntax-highlighter-line-number">44<!-- -->
</span><span class="syntax-highlighter-line-number">45<!-- -->
</span><span class="syntax-highlighter-line-number">46<!-- -->
</span><span class="syntax-highlighter-line-number">47<!-- -->
</span><span class="syntax-highlighter-line-number">48<!-- -->
</span><span class="syntax-highlighter-line-number">49<!-- -->
</span><span class="syntax-highlighter-line-number">50<!-- -->
</span><span class="syntax-highlighter-line-number">51<!-- -->
</span><span class="syntax-highlighter-line-number">52<!-- -->
</span><span class="syntax-highlighter-line-number">53<!-- -->
</span><span class="syntax-highlighter-line-number">54</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"os"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	file, err := os.Open("draconomicon.pdf")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	defer file.Close()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	uploadedFile, err := client.Files.New(context.Background(), openai.FileNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		File:    file,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Purpose: openai.FilePurposeUserData,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			OfInputItemList: responses.ResponseInputParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				responses.ResponseInputItemParamOfMessage(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					responses.ResponseInputMessageContentListParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							OfInputFile: &amp;responses.ResponseInputFileParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">								FileID: openai.String(uploadedFile.ID),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						responses.ResponseInputContentParamOfInputText(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">							"What is the first dragon in the book?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">						),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">					responses.EasyInputMessageRoleUser,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Files;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">OpenAIFileClient files = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">OpenAIFile file = await files.UploadFileAsync(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "draconomicon.pdf",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    FileUploadPurpose.UserData</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ResponseItem.CreateUserMessageItem(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputFilePart(file.Id),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ResponseContentPart.CreateInputTextPart(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "What is the first dragon in the book?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">file = openai.files.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  file: File.open("draconomicon.pdf", "rb"),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  purpose: "user_data"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      role: "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      content: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {type: "input_file", file_id: file.id},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {type: "input_text", text: "What is the first dragon in the book?"}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r173R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl https://api.openai.com/v1/files \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -F purpose="user_data" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -F file="@draconomicon.pdf"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">curl "https://api.openai.com/v1/responses" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "input": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "content": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_file",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "file_id": "file-6F2ksmvXxt4VdoqmHRw6kL"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "input_text",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "text": "What is the first dragon in the book?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }'</span></span></code></pre></div></div></div></astro-island></div> </div> <script data-astro-exec="">
    if (!window.__contentSwitcherInit) {
      window.__contentSwitcherInit = true;

      var queryWithinRoot = function (root, selector) {
        if (!root) return [];
        // A guide pane can contain child switchers. Only update elements owned
        // by this root so parent hydration does not reset nested state.
        return Array.from(root.querySelectorAll(selector)).filter(
          function (element) {
            return element.closest("[data-content-switcher-root]") === root;
          }
        );
      };

      var updateButtons = function (root, value) {
        if (!root || !value) return;
        // Avoid mutating React-managed segmented controls before hydration.
        if (!root.hasAttribute("data-react-hydrated")) return;
        var buttons = queryWithinRoot(root, "[data-content-switcher-option]");
        var activeButton = null;
        buttons.forEach(function (button) {
          var isActive = button.dataset.value === value;
          button.setAttribute("data-state", isActive ? "on" : "off");
          button.setAttribute("aria-checked", isActive ? "true" : "false");
          if (isActive) {
            activeButton = button;
          }
        });

        var control = queryWithinRoot(
          root,
          '[role="group"][aria-label="Content switcher"]'
        )[0];
        var thumb = control
          ? control.querySelector('[class*="SegmentedControlThumb"]')
          : null;
        if (thumb && activeButton && control) {
          var targetWidth = Math.floor(activeButton.clientWidth);
          var targetOffset = activeButton.offsetLeft;
          if (control.clientWidth - (targetWidth + targetOffset) < 2) {
            targetWidth = targetWidth - 1;
          }
          thumb.style.width = targetWidth + "px";
          thumb.style.transform = "translateX(" + targetOffset + "px)";
        }
      };

      var refreshToc = function () {
        requestAnimationFrame(function () {
          document.dispatchEvent(new CustomEvent("toc:refresh"));
        });
      };

      var setValue = function (root, value) {
        if (!root || !value) return;
        root.dataset.contentSwitcherValue = value;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        panes.forEach(function (pane) {
          if (pane.dataset.value === value) {
            pane.removeAttribute("hidden");
          } else {
            pane.setAttribute("hidden", "");
          }
        });
        updateButtons(root, value);
        refreshToc();
      };

      var getQueryValue = function (root) {
        if (!root) return null;
        var id = root.dataset.contentSwitcherId;
        if (!id) return null;
        var params = new URLSearchParams(window.location.search);
        var value = params.get(id);
        if (!value) return null;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        var hasMatch = panes.some(function (pane) {
          return pane.dataset.value === value;
        });
        if (hasMatch) return value;

        var aliases = {};
        try {
          aliases = JSON.parse(
            root.dataset.contentSwitcherQueryValueAliases || "{}"
          );
        } catch {
          aliases = {};
        }
        var alias = aliases[value];
        var hasAliasMatch =
          typeof alias === "string" &&
          panes.some(function (pane) {
            return pane.dataset.value === alias;
          });
        return hasAliasMatch ? alias : null;
      };

      var initRoot = function (root) {
        if (!root) return;
        var queryValue = getQueryValue(root);
        var initial = root.dataset.contentSwitcherInitial;
        var nextValue = queryValue || initial;
        if (nextValue) {
          setValue(root, nextValue);
        }
      };

      var navigateBeforeHydration = function (root, value) {
        if (!root || !value || root.hasAttribute("data-react-hydrated")) {
          return false;
        }
        if (root.dataset.contentSwitcherValue === value) return false;

        var id = root.dataset.contentSwitcherId;
        if (!id) return false;

        var url = new URL(window.location.href);
        url.searchParams.set(id, value);
        if (root.dataset.contentSwitcherPreserveHash === "false") {
          url.hash = "";
        }

        if (root.dataset.contentSwitcherNavigationMode === "document") {
          window.location.assign(url.toString());
          return true;
        }

        window.history.pushState({}, "", url);
        window.dispatchEvent(new PopStateEvent("popstate"));
        return false;
      };

      document
        .querySelectorAll("[data-content-switcher-root]")
        .forEach(initRoot);

      document.addEventListener("content-switcher:set", function (event) {
        var detail = event?.detail || {};
        var target = event.target;
        var root =
          target && target.closest
            ? target.closest("[data-content-switcher-root]")
            : null;
        if (!root && detail.id) {
          root = document.querySelector(
            '[data-content-switcher-root][data-content-switcher-id="' +
              detail.id +
              '"]'
          );
        }
        if (root && typeof detail.value === "string") {
          setValue(root, detail.value);
        }
      });

      window.addEventListener("popstate", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });

      document.addEventListener("click", function (event) {
        var target = event.target;
        if (!target || !target.closest) return;
        var button = target.closest("[data-content-switcher-option]");
        if (!button) return;
        var root = button.closest("[data-content-switcher-root]");
        if (!root) return;
        if (root.hasAttribute("data-react-hydrated")) return;
        var value = button.dataset.value;
        if (value) {
          var isDocumentNavigation = navigateBeforeHydration(root, value);
          if (!isDocumentNavigation) {
            setValue(root, value);
          }
        }
      });

      document.addEventListener("astro:page-load", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });
    }
  </script> </div>
<a href="/api/docs/guides/images" to="/api/docs/guides/images" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 4a3 3 0 0 0-2.6 1.5 1 1 0 0 1-.865.5H5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-3.535a1 1 0 0 1-.866-.5A2.998 2.998 0 0 0 12 4ZM8 4a4.993 4.993 0 0 1 4-2 4.99 4.99 0 0 1 4 2h3a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h3Zm4 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z" clip-rule="evenodd"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Image inputs guide</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn to use image inputs to the model and extract meaning from images.</p> </div> </div> </div></a>
<a href="/api/docs/guides/file-inputs" to="/api/docs/guides/file-inputs" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">File inputs guide</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn to use file inputs to the model and extract meaning from documents.</p> </div> </div> </div></a>
<h2 id="extend-the-model-with-tools" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Extend the model with tools</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="extend-the-model-with-tools" aria-label="Copy link to extend the model with tools" title="Copy link to extend the model with tools"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<p>Give the model access to external data and functions by attaching <a href="/api/docs/guides/tools">tools</a>. Use built-in tools like web search or file search, or define your own for calling APIs, running code, or integrating with third-party systems.</p>
<div id="content-switcher-tool-type" class="content-switcher-root mt-6 astro-cr4aci74" data-content-switcher-root="" data-content-switcher-id="tool-type" data-content-switcher-initial="web-search" data-content-switcher-value="web-search" data-content-switcher-preserve-hash="true" data-content-switcher-navigation-mode="history" data-content-switcher-query-value-aliases="{}" data-react-hydrated="true"> <div class="content-switcher-selector mb-6 astro-cr4aci74"> <astro-island uid="UIvl5" prefix="r141" component-url="/_astro/SwitcherSelector.react.Cwe_o7Xe.js" component-export="default" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;rootId&quot;:[0,&quot;content-switcher-tool-type&quot;],&quot;id&quot;:[0,&quot;tool-type&quot;],&quot;options&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Web search&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;web-search&quot;]}],[0,{&quot;label&quot;:[0,&quot;File search&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;file-search&quot;]}],[0,{&quot;label&quot;:[0,&quot;Code Interpreter&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;code-interpreter&quot;]}],[0,{&quot;label&quot;:[0,&quot;Function calling&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;function-calling&quot;]}],[0,{&quot;label&quot;:[0,&quot;Remote MCP&quot;],&quot;tooltip&quot;:[0],&quot;value&quot;:[0,&quot;remote-mcp&quot;]}]]],&quot;initialValue&quot;:[0,&quot;web-search&quot;],&quot;preserveHash&quot;:[0,true],&quot;navigationMode&quot;:[0,&quot;history&quot;],&quot;queryValueAliases&quot;:[0,{}]}" client="load" opts="{&quot;name&quot;:&quot;SwitcherSelector&quot;,&quot;value&quot;:true}" await-children=""><div role="group" dir="ltr" class="_SegmentedControl_16x8u_1" data-size="md" aria-label="Content switcher" tabindex="0" style="outline:none"><div class="_SegmentedControlThumb_16x8u_226" style="width: 101px; transform: translateX(2px); transition: width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter);"></div><button type="button" data-state="on" role="radio" aria-checked="true" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="web-search" tabindex="-1" data-radix-collection-item=""><span class="relative">Web search</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="file-search" tabindex="-1" data-radix-collection-item=""><span class="relative">File search</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="code-interpreter" tabindex="-1" data-radix-collection-item=""><span class="relative">Code Interpreter</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="function-calling" tabindex="-1" data-radix-collection-item=""><span class="relative">Function calling</span></button><button type="button" data-state="off" role="radio" aria-checked="false" class="_SegmentedControlOption_16x8u_142" data-content-switcher-option="true" data-value="remote-mcp" tabindex="-1" data-radix-collection-item=""><span class="relative">Remote MCP</span></button></div></astro-island> </div> <div class="content-switcher-panes astro-cr4aci74"> <div data-content-switcher-pane="true" data-value="web-search"><div class="hidden">Web search</div><astro-island uid="1kWSm9" prefix="r176" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Use web search in a response&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst response = await client.responses.create({\n  model: \&quot;{{MODEL}}\&quot;,\n  tools: [{ type: \&quot;web_search\&quot; }],\n  input: \&quot;What was a positive news story from today?\&quot;,\n});\n\nconsole.log(response.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;{{MODEL}}\&quot;,\n    tools=[{\&quot;type\&quot;: \&quot;web_search\&quot;}],\n    input=\&quot;What was a positive news story from today?\&quot;,\n)\n\nprint(response.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;{{MODEL}}\&quot;,\n\t\tTools: []responses.ToolUnionParam{\n\t\t\tresponses.ToolParamOfWebSearch(responses.WebSearchToolTypeWebSearch),\n\t\t},\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;What was a positive news story from today?\&quot;)},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nCreateResponseOptions options = new() { Model = \&quot;{{MODEL}}\&quot; };\noptions.Tools.Add(ResponseTool.CreateWebSearchTool());\noptions.InputItems.Add(\n    ResponseItem.CreateUserMessageItem(\&quot;What was a positive news story from today?\&quot;)\n);\n\nResponseResult response = await client.CreateResponseAsync(options);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;{{MODEL}}\&quot;,\n  tools: [{type: \&quot;web_search\&quot;}],\n  input: \&quot;What was a positive news story from today?\&quot;\n)\n\nputs(response.output_text)&quot;],&quot;curl&quot;:[0,&quot;curl \&quot;https://api.openai.com/v1/responses\&quot; \\\n    -H \&quot;Content-Type: application/json\&quot; \\\n    -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n    -d '{\n        \&quot;model\&quot;: \&quot;{{MODEL}}\&quot;,\n        \&quot;tools\&quot;: [{\&quot;type\&quot;: \&quot;web_search\&quot;}],\n        \&quot;input\&quot;: \&quot;what was a positive news story from today?\&quot;\n}'&quot;],&quot;cli&quot;:[0,&quot;openai responses create \\\n  --model {{MODEL}} \\\n  --raw-output \\\n  --transform 'output.#(type==\&quot;message\&quot;).content.0.text' &lt;&lt;'YAML'\ntools:\n  - type: web_search\ninput: What was a positive news story from today?\nYAML&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Use web search in a response</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r176R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r176R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r176R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  tools: [{ type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"web_search"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> }],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"What was a positive news story from today?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    tools=[{"type": "web_search"}],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input="What was a positive news story from today?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Tools: []responses.ToolUnionParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			responses.ToolParamOfWebSearch(responses.WebSearchToolTypeWebSearch),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What was a positive news story from today?")},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">CreateResponseOptions options = new() { Model = "gpt-5.6" };</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.Tools.Add(ResponseTool.CreateWebSearchTool());</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.InputItems.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseItem.CreateUserMessageItem("What was a positive news story from today?")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(options);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: [{type: "web_search"}],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: "What was a positive news story from today?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl "https://api.openai.com/v1/responses" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "tools": [{"type": "web_search"}],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "input": "what was a positive news story from today?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}'</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r176R_3q_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8</span></span><span class="syntax-highlighter-line"><span class="shiki-token">openai responses create \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --model gpt-5.6 \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --raw-output \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  --transform 'output.#(type=="message").content.0.text' &lt;&lt;'YAML'</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">tools:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  - type: web_search</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">input: What was a positive news story from today?</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">YAML</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="file-search" hidden=""><div class="hidden">File search</div><astro-island uid="ZyOz3R" prefix="r177" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Search your files in a response&quot;],&quot;highlighted&quot;:[0,true],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst openai = new OpenAI();\n\nconst response = await openai.responses.create({\n  model: \&quot;gpt-5.6\&quot;,\n  input: \&quot;What is deep research by OpenAI?\&quot;,\n  tools: [\n    {\n      type: \&quot;file_search\&quot;,\n      vector_store_ids: [\&quot;&lt;vector_store_id&gt;\&quot;],\n    },\n  ],\n});\nconsole.log(response);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;gpt-5.6\&quot;,\n    input=\&quot;What is deep research by OpenAI?\&quot;,\n    tools=[{\&quot;type\&quot;: \&quot;file_search\&quot;, \&quot;vector_store_ids\&quot;: [\&quot;&lt;vector_store_id&gt;\&quot;]}],\n)\nprint(response)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;gpt-5.6\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;What is deep research by OpenAI?\&quot;)},\n\t\tTools: []responses.ToolUnionParam{responses.ToolParamOfFileSearch([]string{\&quot;&lt;vector_store_id&gt;\&quot;})},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response)\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nCreateResponseOptions options = new() { Model = \&quot;gpt-5.6\&quot; };\noptions.Tools.Add(\n    ResponseTool.CreateFileSearchTool([\&quot;&lt;vector_store_id&gt;\&quot;])\n);\noptions.InputItems.Add(\n    ResponseItem.CreateUserMessageItem(\&quot;What is deep research by OpenAI?\&quot;)\n);\n\nResponseResult response = await client.CreateResponseAsync(options);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;gpt-5.6\&quot;,\n  input: \&quot;What is deep research by OpenAI?\&quot;,\n  tools: [\n    {\n      type: \&quot;file_search\&quot;,\n      vector_store_ids: [\&quot;&lt;vector_store_id&gt;\&quot;]\n    }\n  ]\n)\n\nputs(response)&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Search your files in a response</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r177R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r177R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r177R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r177R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">openai</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> openai.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"What is deep research by OpenAI?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"file_search"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      vector_store_ids: [</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"&lt;vector_store_id&gt;"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r177R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input="What is deep research by OpenAI?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    tools=[{"type": "file_search", "vector_store_ids": ["&lt;vector_store_id&gt;"]}],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r177R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is deep research by OpenAI?")},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Tools: []responses.ToolUnionParam{responses.ToolParamOfFileSearch([]string{"&lt;vector_store_id&gt;"})},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r177R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">CreateResponseOptions options = new() { Model = "gpt-5.6" };</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.Tools.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseTool.CreateFileSearchTool(["&lt;vector_store_id&gt;"])</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.InputItems.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseItem.CreateUserMessageItem("What is deep research by OpenAI?")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(options);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r177R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: "What is deep research by OpenAI?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      type: "file_search",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      vector_store_ids: ["&lt;vector_store_id&gt;"]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response)</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="code-interpreter" hidden=""><div class="hidden">Code Interpreter</div><astro-island uid="8R0o8" prefix="r178" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Use Code Interpreter in a response&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst response = await client.responses.create({\n  model: \&quot;{{MODEL}}\&quot;,\n  instructions:\n    \&quot;You are a personal math tutor. When asked a math question, write and run code to answer the question.\&quot;,\n  tools: [\n    {\n      type: \&quot;code_interpreter\&quot;,\n      container: { type: \&quot;auto\&quot; },\n    },\n  ],\n  input: \&quot;I need to solve the equation 3x + 11 = 14. Can you help me?\&quot;,\n});\n\nconsole.log(response.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresponse = client.responses.create(\n    model=\&quot;{{MODEL}}\&quot;,\n    instructions=\&quot;You are a personal math tutor. When asked a math question, write and run code to answer the question.\&quot;,\n    tools=[{\&quot;type\&quot;: \&quot;code_interpreter\&quot;, \&quot;container\&quot;: {\&quot;type\&quot;: \&quot;auto\&quot;}}],\n    input=\&quot;I need to solve the equation 3x + 11 = 14. Can you help me?\&quot;,\n)\n\nprint(response.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel:        \&quot;{{MODEL}}\&quot;,\n\t\tInstructions: openai.String(\&quot;You are a personal math tutor. When asked a math question, write and run code to answer the question.\&quot;),\n\t\tTools: []responses.ToolUnionParam{\n\t\t\tresponses.ToolParamOfCodeInterpreter(responses.ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam{}),\n\t\t},\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;I need to solve the equation 3x + 11 = 14. Can you help me?\&quot;)},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;{{MODEL}}\&quot;,\n  instructions: \&quot;You are a personal math tutor. When asked a math question, write and run code to answer the question.\&quot;,\n  tools: [\n    {\n      type: \&quot;code_interpreter\&quot;,\n      container: {type: \&quot;auto\&quot;}\n    }\n  ],\n  input: \&quot;I need to solve the equation 3x + 11 = 14. Can you help me?\&quot;\n)\n\nputs(response.output_text)&quot;],&quot;curl&quot;:[0,&quot;curl https://api.openai.com/v1/responses \\\n  -H \&quot;Content-Type: application/json\&quot; \\\n  -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n  -d '{\n    \&quot;model\&quot;: \&quot;{{MODEL}}\&quot;,\n    \&quot;instructions\&quot;: \&quot;You are a personal math tutor. When asked a math question, write and run code to answer the question.\&quot;,\n    \&quot;tools\&quot;: [\n      {\n        \&quot;type\&quot;: \&quot;code_interpreter\&quot;,\n        \&quot;container\&quot;: { \&quot;type\&quot;: \&quot;auto\&quot; }\n      }\n    ],\n    \&quot;input\&quot;: \&quot;I need to solve the equation 3x + 11 = 14. Can you help me?\&quot;\n  }'&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Use Code Interpreter in a response</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r178R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r178R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r178R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r178R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  instructions:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"You are a personal math tutor. When asked a math question, write and run code to answer the question."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"code_interpreter"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      container: { type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"auto"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"I need to solve the equation 3x + 11 = 14. Can you help me?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r178R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    instructions="You are a personal math tutor. When asked a math question, write and run code to answer the question.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    tools=[{"type": "code_interpreter", "container": {"type": "auto"}}],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input="I need to solve the equation 3x + 11 = 14. Can you help me?",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r178R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model:        "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Instructions: openai.String("You are a personal math tutor. When asked a math question, write and run code to answer the question."),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Tools: []responses.ToolUnionParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			responses.ToolParamOfCodeInterpreter(responses.ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam{}),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("I need to solve the equation 3x + 11 = 14. Can you help me?")},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r178R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  instructions: "You are a personal math tutor. When asked a math question, write and run code to answer the question.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      type: "code_interpreter",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      container: {type: "auto"}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: "I need to solve the equation 3x + 11 = 14. Can you help me?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r178R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl https://api.openai.com/v1/responses \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "instructions": "You are a personal math tutor. When asked a math question, write and run code to answer the question.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "tools": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "type": "code_interpreter",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "container": { "type": "auto" }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "input": "I need to solve the equation 3x + 11 = 14. Can you help me?"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  }'</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="function-calling" hidden=""><div class="hidden">Function calling</div><astro-island uid="q1RHi" prefix="r179" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Call your own function&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\n/** @type {OpenAI.Responses.Tool[]} */\nconst tools = [\n  {\n    type: \&quot;function\&quot;,\n    name: \&quot;get_weather\&quot;,\n    description: \&quot;Get current temperature for a given location.\&quot;,\n    parameters: {\n      type: \&quot;object\&quot;,\n      properties: {\n        location: {\n          type: \&quot;string\&quot;,\n          description: \&quot;City and country e.g. Bogotá, Colombia\&quot;,\n        },\n      },\n      required: [\&quot;location\&quot;],\n      additionalProperties: false,\n    },\n    strict: true,\n  },\n];\n\nconst response = await client.responses.create({\n  model: \&quot;{{MODEL}}\&quot;,\n  input: [\n    { role: \&quot;user\&quot;, content: \&quot;What is the weather like in Paris today?\&quot; },\n  ],\n  tools,\n});\n\nconsole.log(response.output[0]);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\ntools = [\n    {\n        \&quot;type\&quot;: \&quot;function\&quot;,\n        \&quot;name\&quot;: \&quot;get_weather\&quot;,\n        \&quot;description\&quot;: \&quot;Get current temperature for a given location.\&quot;,\n        \&quot;parameters\&quot;: {\n            \&quot;type\&quot;: \&quot;object\&quot;,\n            \&quot;properties\&quot;: {\n                \&quot;location\&quot;: {\n                    \&quot;type\&quot;: \&quot;string\&quot;,\n                    \&quot;description\&quot;: \&quot;City and country e.g. Bogotá, Colombia\&quot;,\n                }\n            },\n            \&quot;required\&quot;: [\&quot;location\&quot;],\n            \&quot;additionalProperties\&quot;: False,\n        },\n        \&quot;strict\&quot;: True,\n    },\n]\n\nresponse = client.responses.create(\n    model=\&quot;{{MODEL}}\&quot;,\n    input=[\n        {\&quot;role\&quot;: \&quot;user\&quot;, \&quot;content\&quot;: \&quot;What is the weather like in Paris today?\&quot;},\n    ],\n    tools=tools,\n)\n\nprint(response.output[0].to_json())&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tparameters := map[string]any{\n\t\t\&quot;type\&quot;: \&quot;object\&quot;,\n\t\t\&quot;properties\&quot;: map[string]any{\n\t\t\t\&quot;location\&quot;: map[string]any{\n\t\t\t\t\&quot;type\&quot;:        \&quot;string\&quot;,\n\t\t\t\t\&quot;description\&quot;: \&quot;City and country e.g. Bogotá, Colombia\&quot;,\n\t\t\t},\n\t\t},\n\t\t\&quot;required\&quot;:             []string{\&quot;location\&quot;},\n\t\t\&quot;additionalProperties\&quot;: false,\n\t}\n\ttool := responses.ToolParamOfFunction(\&quot;get_weather\&quot;, parameters, true)\n\ttool.OfFunction.Description = openai.String(\&quot;Get current temperature for a given location.\&quot;)\n\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;{{MODEL}}\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{\n\t\t\tresponses.ResponseInputItemParamOfMessage(\&quot;What is the weather like in Paris today?\&quot;, responses.EasyInputMessageRoleUser),\n\t\t}},\n\t\tTools: []responses.ToolUnionParam{tool},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response.Output)\n}&quot;],&quot;csharp&quot;:[0,&quot;using System.Text.Json;\nusing System.Text.Json.Serialization.Metadata;\nusing OpenAI.Responses;\n#pragma warning disable CA1869\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nCreateResponseOptions options = new() { Model = \&quot;{{MODEL}}\&quot; };\noptions.Tools.Add(\n    ResponseTool.CreateFunctionTool(\n        functionName: \&quot;get_weather\&quot;,\n        functionDescription: \&quot;Get current temperature for a given location.\&quot;,\n        functionParameters: BinaryData.FromString(\n            \&quot;\&quot;\&quot;\n            {\n                \&quot;type\&quot;: \&quot;object\&quot;,\n                \&quot;properties\&quot;: {\n                    \&quot;location\&quot;: {\n                        \&quot;type\&quot;: \&quot;string\&quot;,\n                        \&quot;description\&quot;: \&quot;City and country e.g. Bogotá, Colombia\&quot;\n                    }\n                },\n                \&quot;required\&quot;: [\&quot;location\&quot;],\n                \&quot;additionalProperties\&quot;: false\n            }\n            \&quot;\&quot;\&quot;\n        ),\n        strictModeEnabled: true\n    )\n);\noptions.InputItems.Add(\n    ResponseItem.CreateUserMessageItem(\&quot;What is the weather like in Paris today?\&quot;)\n);\n\nResponseResult response = client.CreateResponse(options);\nConsole.WriteLine(\n    JsonSerializer.Serialize(\n        response.OutputItems[0],\n        new JsonSerializerOptions\n        {\n            TypeInfoResolver = new DefaultJsonTypeInfoResolver(),\n        }\n    )\n);&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\ntools = [\n  {\n    type: \&quot;function\&quot;,\n    name: \&quot;get_weather\&quot;,\n    description: \&quot;Get current temperature for a given location.\&quot;,\n    parameters: {\n      type: \&quot;object\&quot;,\n      properties: {\n        location: {\n          type: \&quot;string\&quot;,\n          description: \&quot;City and country e.g. Bogotá, Colombia\&quot;\n        }\n      },\n      required: [\&quot;location\&quot;],\n      additionalProperties: false\n    },\n    strict: true\n  }\n]\n\nresponse = openai.responses.create(\n  model: \&quot;{{MODEL}}\&quot;,\n  input: [\n    {role: \&quot;user\&quot;, content: \&quot;What is the weather like in Paris today?\&quot;}\n  ],\n  tools: tools\n)\n\nputs(response.output.first.to_json)&quot;],&quot;bash&quot;:[0,&quot;curl -X POST https://api.openai.com/v1/responses \\\n  -H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\\n  -H \&quot;Content-Type: application/json\&quot; \\\n  -d '{\n    \&quot;model\&quot;: \&quot;{{MODEL}}\&quot;,\n    \&quot;input\&quot;: [\n      {\&quot;role\&quot;: \&quot;user\&quot;, \&quot;content\&quot;: \&quot;What is the weather like in Paris today?\&quot;}\n    ],\n    \&quot;tools\&quot;: [\n      {\n        \&quot;type\&quot;: \&quot;function\&quot;,\n        \&quot;name\&quot;: \&quot;get_weather\&quot;,\n        \&quot;description\&quot;: \&quot;Get current temperature for a given location.\&quot;,\n        \&quot;parameters\&quot;: {\n          \&quot;type\&quot;: \&quot;object\&quot;,\n          \&quot;properties\&quot;: {\n            \&quot;location\&quot;: {\n              \&quot;type\&quot;: \&quot;string\&quot;,\n              \&quot;description\&quot;: \&quot;City and country e.g. Bogotá, Colombia\&quot;\n            }\n          },\n          \&quot;required\&quot;: [\&quot;location\&quot;],\n          \&quot;additionalProperties\&quot;: false\n        },\n        \&quot;strict\&quot;: true\n      }\n    ]\n  }'&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Call your own function</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r179R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r179R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r179R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> OpenAI </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#6A737D;--shiki-light:#6A737D">/** </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">@type</span><span class="shiki-token" style="--shiki-dark:#6A737D;--shiki-light:#6A737D"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">{OpenAI.Responses.Tool[]}</span><span class="shiki-token" style="--shiki-dark:#6A737D;--shiki-light:#6A737D"> */</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">tools</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"function"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    name: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"get_weather"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    description: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Get current temperature for a given location."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    parameters: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"object"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      properties: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        location: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          type: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"string"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">          description: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"City and country e.g. Bogotá, Colombia"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      required: [</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"location"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      additionalProperties: </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">false</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    strict: </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">true</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">];</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">response</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    { role: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">, content: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"What is the weather like in Paris today?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  tools,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(response.output[</span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">0</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">]);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">tools = [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "type": "function",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "name": "get_weather",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "description": "Get current temperature for a given location.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "parameters": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "type": "object",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "properties": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "location": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "type": "string",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "description": "City and country e.g. Bogotá, Colombia",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "required": ["location"],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "additionalProperties": False,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "strict": True,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">]</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {"role": "user", "content": "What is the weather like in Paris today?"},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    tools=tools,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(response.output[0].to_json())</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33<!-- -->
</span><span class="syntax-highlighter-line-number">34<!-- -->
</span><span class="syntax-highlighter-line-number">35<!-- -->
</span><span class="syntax-highlighter-line-number">36<!-- -->
</span><span class="syntax-highlighter-line-number">37<!-- -->
</span><span class="syntax-highlighter-line-number">38</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	parameters := map[string]any{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		"type": "object",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		"properties": map[string]any{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			"location": map[string]any{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				"type":        "string",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">				"description": "City and country e.g. Bogotá, Colombia",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		"required":             []string{"location"},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		"additionalProperties": false,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool := responses.ToolParamOfFunction("get_weather", parameters, true)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool.OfFunction.Description = openai.String("Get current temperature for a given location.")</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">			responses.ResponseInputItemParamOfMessage("What is the weather like in Paris today?", responses.EasyInputMessageRoleUser),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		}},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Tools: []responses.ToolUnionParam{tool},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.Output)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33<!-- -->
</span><span class="syntax-highlighter-line-number">34<!-- -->
</span><span class="syntax-highlighter-line-number">35<!-- -->
</span><span class="syntax-highlighter-line-number">36<!-- -->
</span><span class="syntax-highlighter-line-number">37<!-- -->
</span><span class="syntax-highlighter-line-number">38<!-- -->
</span><span class="syntax-highlighter-line-number">39<!-- -->
</span><span class="syntax-highlighter-line-number">40<!-- -->
</span><span class="syntax-highlighter-line-number">41<!-- -->
</span><span class="syntax-highlighter-line-number">42<!-- -->
</span><span class="syntax-highlighter-line-number">43<!-- -->
</span><span class="syntax-highlighter-line-number">44<!-- -->
</span><span class="syntax-highlighter-line-number">45<!-- -->
</span><span class="syntax-highlighter-line-number">46</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using System.Text.Json;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">using System.Text.Json.Serialization.Metadata;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable CA1869</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">CreateResponseOptions options = new() { Model = "gpt-5.6" };</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.Tools.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseTool.CreateFunctionTool(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        functionName: "get_weather",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        functionDescription: "Get current temperature for a given location.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        functionParameters: BinaryData.FromString(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            """</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "type": "object",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "properties": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    "location": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "type": "string",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                        "description": "City and country e.g. Bogotá, Colombia"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "required": ["location"],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">                "additionalProperties": false</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            """</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        ),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        strictModeEnabled: true</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    )</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.InputItems.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseItem.CreateUserMessageItem("What is the weather like in Paris today?")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = client.CreateResponse(options);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    JsonSerializer.Serialize(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        response.OutputItems[0],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        new JsonSerializerOptions</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            TypeInfoResolver = new DefaultJsonTypeInfoResolver(),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    )</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28<!-- -->
</span><span class="syntax-highlighter-line-number">29<!-- -->
</span><span class="syntax-highlighter-line-number">30<!-- -->
</span><span class="syntax-highlighter-line-number">31<!-- -->
</span><span class="syntax-highlighter-line-number">32<!-- -->
</span><span class="syntax-highlighter-line-number">33</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">tools = [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    type: "function",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    name: "get_weather",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    description: "Get current temperature for a given location.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    parameters: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      type: "object",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      properties: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        location: {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          type: "string",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          description: "City and country e.g. Bogotá, Colombia"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      required: ["location"],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      additionalProperties: false</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    strict: true</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">]</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {role: "user", content: "What is the weather like in Paris today?"}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: tools</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output.first.to_json)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r179R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27<!-- -->
</span><span class="syntax-highlighter-line-number">28</span></span><span class="syntax-highlighter-line"><span class="shiki-token">curl -X POST https://api.openai.com/v1/responses \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -H "Authorization: Bearer $OPENAI_API_KEY" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -H "Content-Type: application/json" \</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  -d '{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "input": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      {"role": "user", "content": "What is the weather like in Paris today?"}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "tools": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "type": "function",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "name": "get_weather",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "description": "Get current temperature for a given location.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "parameters": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          "type": "object",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          "properties": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "location": {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">              "type": "string",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">              "description": "City and country e.g. Bogotá, Colombia"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          "required": ["location"],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">          "additionalProperties": false</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "strict": true</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  }'</span></span></code></pre></div></div></div></astro-island></div><div data-content-switcher-pane="true" data-value="remote-mcp" hidden=""><div class="hidden">Remote MCP</div><astro-island uid="ZCNEqq" prefix="r180" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Call a remote MCP server&quot;],&quot;highlighted&quot;:[0,true],&quot;code&quot;:[0,{&quot;curl&quot;:[0,&quot;curl https://api.openai.com/v1/responses \\ \n-H \&quot;Content-Type: application/json\&quot; \\ \n-H \&quot;Authorization: Bearer $OPENAI_API_KEY\&quot; \\ \n-d '{\n  \&quot;model\&quot;: \&quot;gpt-5.6\&quot;,\n    \&quot;tools\&quot;: [\n      {\n        \&quot;type\&quot;: \&quot;mcp\&quot;,\n        \&quot;server_label\&quot;: \&quot;dmcp\&quot;,\n        \&quot;server_description\&quot;: \&quot;A Dungeons and Dragons MCP server to assist with dice rolling.\&quot;,\n        \&quot;server_url\&quot;: \&quot;https://dmcp-server.deno.dev/mcp\&quot;,\n        \&quot;require_approval\&quot;: \&quot;never\&quot;\n      }\n    ],\n    \&quot;input\&quot;: \&quot;Roll 2d4+1\&quot;\n  }'&quot;],&quot;javascript&quot;:[0,&quot;import OpenAI from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst resp = await client.responses.create({\n  model: \&quot;gpt-5.6\&quot;,\n  tools: [\n    {\n      type: \&quot;mcp\&quot;,\n      server_label: \&quot;dmcp\&quot;,\n      server_description:\n        \&quot;A Dungeons and Dragons MCP server to assist with dice rolling.\&quot;,\n      server_url: \&quot;https://dmcp-server.deno.dev/mcp\&quot;,\n      require_approval: \&quot;never\&quot;,\n    },\n  ],\n  input: \&quot;Roll 2d4+1\&quot;,\n});\n\nconsole.log(resp.output_text);&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nresp = client.responses.create(\n    model=\&quot;gpt-5.6\&quot;,\n    tools=[\n        {\n            \&quot;type\&quot;: \&quot;mcp\&quot;,\n            \&quot;server_label\&quot;: \&quot;dmcp\&quot;,\n            \&quot;server_description\&quot;: \&quot;A Dungeons and Dragons MCP server to assist with dice rolling.\&quot;,\n            \&quot;server_url\&quot;: \&quot;https://dmcp-server.deno.dev/mcp\&quot;,\n            \&quot;require_approval\&quot;: \&quot;never\&quot;,\n        },\n    ],\n    input=\&quot;Roll 2d4+1\&quot;,\n)\n\nprint(resp.output_text)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\ttool := responses.ToolParamOfMcp(\&quot;dmcp\&quot;)\n\ttool.OfMcp.ServerDescription = openai.String(\&quot;A Dungeons and Dragons MCP server to assist with dice rolling.\&quot;)\n\ttool.OfMcp.ServerURL = openai.String(\&quot;https://dmcp-server.deno.dev/mcp\&quot;)\n\ttool.OfMcp.RequireApproval = responses.ToolMcpRequireApprovalUnionParam{OfMcpToolApprovalSetting: openai.String(\&quot;never\&quot;)}\n\n\tresponse, err := client.Responses.New(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;gpt-5.6\&quot;,\n\t\tTools: []responses.ToolUnionParam{tool},\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;Roll 2d4+1\&quot;)},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(response.OutputText())\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nCreateResponseOptions options = new() { Model = \&quot;gpt-5.6\&quot; };\noptions.Tools.Add(\n    ResponseTool.CreateMcpTool(\n        serverLabel: \&quot;dmcp\&quot;,\n        serverUri: new Uri(\&quot;https://dmcp-server.deno.dev/mcp\&quot;),\n        toolCallApprovalPolicy: GlobalMcpToolCallApprovalPolicy.NeverRequireApproval\n    )\n);\noptions.InputItems.Add(ResponseItem.CreateUserMessageItem(\&quot;Roll 2d4+1\&quot;));\n\nResponseResult response = await client.CreateResponseAsync(options);\n\nConsole.WriteLine(response.GetOutputText());&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nresponse = openai.responses.create(\n  model: \&quot;gpt-5.6\&quot;,\n  tools: [\n    {\n      type: \&quot;mcp\&quot;,\n      server_label: \&quot;dmcp\&quot;,\n      server_description: \&quot;A Dungeons and Dragons MCP server to assist with dice rolling.\&quot;,\n      server_url: \&quot;https://dmcp-server.deno.dev/mcp\&quot;,\n      require_approval: \&quot;never\&quot;\n    }\n  ],\n  input: \&quot;Roll 2d4+1\&quot;\n)\n\nputs(response.output_text)&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Call a remote MCP server</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r180R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r180R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r180R_7p_">curl</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_q_" tabindex="0"><code data-1p-ignore="true" data-language="bash" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">curl</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">https://api.openai.com/v1/responses</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">\ </span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">-H</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Content-Type: application/json"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">\ </span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">-H</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Authorization: Bearer </span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">$OPENAI_API_KEY</span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">\ </span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">-d</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">'{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">  "model": "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">    "tools": [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">      {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">        "type": "mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">        "server_label": "dmcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">        "server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">        "server_url": "https://dmcp-server.deno.dev/mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">        "require_approval": "never"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">      }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">    "input": "Roll 2d4+1"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">  }'</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19</span></span><span class="syntax-highlighter-line"><span class="shiki-token">import OpenAI from "openai";</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">const client = new OpenAI();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">const resp = await client.responses.create({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      type: "mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_label: "dmcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_description:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        "A Dungeons and Dragons MCP server to assist with dice rolling.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_url: "https://dmcp-server.deno.dev/mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      require_approval: "never",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: "Roll 2d4+1",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">console.log(resp.output_text);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">resp = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    tools=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "type": "mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "server_label": "dmcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "server_url": "https://dmcp-server.deno.dev/mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "require_approval": "never",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input="Roll 2d4+1",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">print(resp.output_text)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool := responses.ToolParamOfMcp("dmcp")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool.OfMcp.ServerDescription = openai.String("A Dungeons and Dragons MCP server to assist with dice rolling.")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool.OfMcp.ServerURL = openai.String("https://dmcp-server.deno.dev/mcp")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	tool.OfMcp.RequireApproval = responses.ToolMcpRequireApprovalUnionParam{OfMcpToolApprovalSetting: openai.String("never")}</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Tools: []responses.ToolUnionParam{tool},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Roll 2d4+1")},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	fmt.Println(response.OutputText())</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">CreateResponseOptions options = new() { Model = "gpt-5.6" };</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.Tools.Add(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ResponseTool.CreateMcpTool(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        serverLabel: "dmcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        serverUri: new Uri("https://dmcp-server.deno.dev/mcp"),</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        toolCallApprovalPolicy: GlobalMcpToolCallApprovalPolicy.NeverRequireApproval</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    )</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">options.InputItems.Add(ResponseItem.CreateUserMessageItem("Roll 2d4+1"));</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponseResult response = await client.CreateResponseAsync(options);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">Console.WriteLine(response.GetOutputText());</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r180R_3a_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">response = openai.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  tools: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      type: "mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_label: "dmcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_description: "A Dungeons and Dragons MCP server to assist with dice rolling.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      server_url: "https://dmcp-server.deno.dev/mcp",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      require_approval: "never"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: "Roll 2d4+1"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">puts(response.output_text)</span></span></code></pre></div></div></div></astro-island></div> </div> <script data-astro-exec="">
    if (!window.__contentSwitcherInit) {
      window.__contentSwitcherInit = true;

      var queryWithinRoot = function (root, selector) {
        if (!root) return [];
        // A guide pane can contain child switchers. Only update elements owned
        // by this root so parent hydration does not reset nested state.
        return Array.from(root.querySelectorAll(selector)).filter(
          function (element) {
            return element.closest("[data-content-switcher-root]") === root;
          }
        );
      };

      var updateButtons = function (root, value) {
        if (!root || !value) return;
        // Avoid mutating React-managed segmented controls before hydration.
        if (!root.hasAttribute("data-react-hydrated")) return;
        var buttons = queryWithinRoot(root, "[data-content-switcher-option]");
        var activeButton = null;
        buttons.forEach(function (button) {
          var isActive = button.dataset.value === value;
          button.setAttribute("data-state", isActive ? "on" : "off");
          button.setAttribute("aria-checked", isActive ? "true" : "false");
          if (isActive) {
            activeButton = button;
          }
        });

        var control = queryWithinRoot(
          root,
          '[role="group"][aria-label="Content switcher"]'
        )[0];
        var thumb = control
          ? control.querySelector('[class*="SegmentedControlThumb"]')
          : null;
        if (thumb && activeButton && control) {
          var targetWidth = Math.floor(activeButton.clientWidth);
          var targetOffset = activeButton.offsetLeft;
          if (control.clientWidth - (targetWidth + targetOffset) < 2) {
            targetWidth = targetWidth - 1;
          }
          thumb.style.width = targetWidth + "px";
          thumb.style.transform = "translateX(" + targetOffset + "px)";
        }
      };

      var refreshToc = function () {
        requestAnimationFrame(function () {
          document.dispatchEvent(new CustomEvent("toc:refresh"));
        });
      };

      var setValue = function (root, value) {
        if (!root || !value) return;
        root.dataset.contentSwitcherValue = value;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        panes.forEach(function (pane) {
          if (pane.dataset.value === value) {
            pane.removeAttribute("hidden");
          } else {
            pane.setAttribute("hidden", "");
          }
        });
        updateButtons(root, value);
        refreshToc();
      };

      var getQueryValue = function (root) {
        if (!root) return null;
        var id = root.dataset.contentSwitcherId;
        if (!id) return null;
        var params = new URLSearchParams(window.location.search);
        var value = params.get(id);
        if (!value) return null;
        var panes = queryWithinRoot(root, "[data-content-switcher-pane]");
        var hasMatch = panes.some(function (pane) {
          return pane.dataset.value === value;
        });
        if (hasMatch) return value;

        var aliases = {};
        try {
          aliases = JSON.parse(
            root.dataset.contentSwitcherQueryValueAliases || "{}"
          );
        } catch {
          aliases = {};
        }
        var alias = aliases[value];
        var hasAliasMatch =
          typeof alias === "string" &&
          panes.some(function (pane) {
            return pane.dataset.value === alias;
          });
        return hasAliasMatch ? alias : null;
      };

      var initRoot = function (root) {
        if (!root) return;
        var queryValue = getQueryValue(root);
        var initial = root.dataset.contentSwitcherInitial;
        var nextValue = queryValue || initial;
        if (nextValue) {
          setValue(root, nextValue);
        }
      };

      var navigateBeforeHydration = function (root, value) {
        if (!root || !value || root.hasAttribute("data-react-hydrated")) {
          return false;
        }
        if (root.dataset.contentSwitcherValue === value) return false;

        var id = root.dataset.contentSwitcherId;
        if (!id) return false;

        var url = new URL(window.location.href);
        url.searchParams.set(id, value);
        if (root.dataset.contentSwitcherPreserveHash === "false") {
          url.hash = "";
        }

        if (root.dataset.contentSwitcherNavigationMode === "document") {
          window.location.assign(url.toString());
          return true;
        }

        window.history.pushState({}, "", url);
        window.dispatchEvent(new PopStateEvent("popstate"));
        return false;
      };

      document
        .querySelectorAll("[data-content-switcher-root]")
        .forEach(initRoot);

      document.addEventListener("content-switcher:set", function (event) {
        var detail = event?.detail || {};
        var target = event.target;
        var root =
          target && target.closest
            ? target.closest("[data-content-switcher-root]")
            : null;
        if (!root && detail.id) {
          root = document.querySelector(
            '[data-content-switcher-root][data-content-switcher-id="' +
              detail.id +
              '"]'
          );
        }
        if (root && typeof detail.value === "string") {
          setValue(root, detail.value);
        }
      });

      window.addEventListener("popstate", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });

      document.addEventListener("click", function (event) {
        var target = event.target;
        if (!target || !target.closest) return;
        var button = target.closest("[data-content-switcher-option]");
        if (!button) return;
        var root = button.closest("[data-content-switcher-root]");
        if (!root) return;
        if (root.hasAttribute("data-react-hydrated")) return;
        var value = button.dataset.value;
        if (value) {
          var isDocumentNavigation = navigateBeforeHydration(root, value);
          if (!isDocumentNavigation) {
            setValue(root, value);
          }
        }
      });

      document.addEventListener("astro:page-load", function () {
        document
          .querySelectorAll("[data-content-switcher-root]")
          .forEach(initRoot);
      });
    }
  </script> </div>
<a href="/api/docs/guides/tools" to="/api/docs/guides/tools" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M6.911 18.962C7.361 19 7.943 19 8.8 19H10a1 1 0 1 1 0 2H8.759c-.805 0-1.47 0-2.01-.044-.563-.046-1.08-.145-1.565-.392a4 4 0 0 1-1.748-1.748c-.247-.485-.346-1.002-.392-1.564C3 16.71 3 16.046 3 15.242V8.758c0-.805 0-1.47.044-2.01.046-.563.145-1.08.392-1.565a4 4 0 0 1 1.748-1.748c.485-.247 1.002-.346 1.564-.392C7.29 3 7.954 3 8.758 3h6.483c.805 0 1.47 0 2.01.044.563.046 1.08.145 1.565.392a4 4 0 0 1 1.748 1.748c.247.485.346 1.002.392 1.564C21 7.29 21 7.954 21 8.758V10a1 1 0 1 1-2 0V8.8c0-.857 0-1.439-.038-1.889-.035-.438-.1-.663-.18-.819a2 2 0 0 0-.874-.874c-.156-.08-.38-.145-.819-.18C16.639 5 16.057 5 15.2 5H8.8c-.857 0-1.439 0-1.889.038-.438.035-.663.1-.819.18a2 2 0 0 0-.874.874c-.08.156-.145.38-.18.819C5 7.361 5 7.943 5 8.8v6.4c0 .857 0 1.439.038 1.889.035.438.1.663.18.819a2 2 0 0 0 .874.874c.156.08.38.145.819.18Z" clip-rule="evenodd"></path><path d="M19 15a1 1 0 1 0-2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2Z"></path><path d="M19 15a1 1 0 1 0-2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2Z"></path><path d="M19 15a1 1 0 1 0-2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2Z"></path><path d="M19 15a1 1 0 1 0-2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2Z"></path><path d="M19 15a1 1 0 1 0-2 0v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2Z"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Use built-in tools</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn about powerful built-in tools like web search and file search.</p> </div> </div> </div></a>
<a href="/api/docs/guides/function-calling" to="/api/docs/guides/function-calling" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><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> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Function calling guide</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn to enable the model to call your own custom code.</p> </div> </div> </div></a>
<h2 id="stream-responses-and-build-real-time-apps" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Stream responses and build real-time apps</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="stream-responses-and-build-real-time-apps" aria-label="Copy link to stream responses and build real time apps" title="Copy link to stream responses and build real time apps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<p>Use server‑sent <a href="/api/docs/guides/streaming-responses">streaming events</a> to show results as they’re generated, or use the <a href="/api/docs/guides/realtime">Realtime API</a> for interactive voice apps and apps with text, audio, and image inputs.</p>
<astro-island uid="ehmd3" prefix="r183" component-url="/_astro/index.react.CIrrdE35.js" component-export="CodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Stream server-sent events from the API&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import { OpenAI } from \&quot;openai\&quot;;\nconst client = new OpenAI();\n\nconst stream = await client.responses.create({\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: \&quot;Say 'double bubble bath' ten times fast.\&quot;,\n    },\n  ],\n  stream: true,\n});\n\nfor await (const event of stream) {\n  console.log(event);\n}&quot;],&quot;python&quot;:[0,&quot;from openai import OpenAI\n\nclient = OpenAI()\n\nstream = client.responses.create(\n    model=\&quot;gpt-5.6\&quot;,\n    input=[\n        {\n            \&quot;role\&quot;: \&quot;user\&quot;,\n            \&quot;content\&quot;: \&quot;Say 'double bubble bath' ten times fast.\&quot;,\n        },\n    ],\n    stream=True,\n)\n\nfor event in stream:\n    print(event)&quot;],&quot;go&quot;:[0,&quot;package main\n\nimport (\n\t\&quot;context\&quot;\n\t\&quot;fmt\&quot;\n\n\t\&quot;github.com/openai/openai-go/v3\&quot;\n\t\&quot;github.com/openai/openai-go/v3/responses\&quot;\n)\n\nfunc main() {\n\tclient := openai.NewClient()\n\tstream := client.Responses.NewStreaming(context.Background(), responses.ResponseNewParams{\n\t\tModel: \&quot;gpt-5.6\&quot;,\n\t\tInput: responses.ResponseNewParamsInputUnion{OfString: openai.String(\&quot;Say 'double bubble bath' ten times fast.\&quot;)},\n\t})\n\tfor stream.Next() {\n\t\tfmt.Println(stream.Current().Type)\n\t}\n\tif err := stream.Err(); err != nil {\n\t\tpanic(err)\n\t}\n}&quot;],&quot;csharp&quot;:[0,&quot;using OpenAI.Responses;\n#pragma warning disable OPENAI001\n\nstring key = Environment.GetEnvironmentVariable(\&quot;OPENAI_API_KEY\&quot;)!;\nResponsesClient client = new(key);\n\nvar responses = client.CreateResponseStreamingAsync(\n    \&quot;gpt-5.6\&quot;,\n    \&quot;Say 'double bubble bath' ten times fast.\&quot;\n);\n\nawait foreach (StreamingResponseUpdate response in responses)\n{\n    if (response is StreamingResponseOutputTextDeltaUpdate delta)\n    {\n        Console.Write(delta.Delta);\n    }\n}&quot;],&quot;ruby&quot;:[0,&quot;require \&quot;openai\&quot;\n\nopenai = OpenAI::Client.new\n\nstream = openai.responses.stream(\n  model: \&quot;gpt-5.6\&quot;,\n  input: [\n    {\n      role: \&quot;user\&quot;,\n      content: \&quot;Say 'double bubble bath' ten times fast.\&quot;\n    }\n  ]\n)\n\nstream.each do |event|\n  puts(event)\nend&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;CodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Stream server-sent events from the API</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r183R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r183R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r183R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r183R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> { OpenAI } </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"openai"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">client</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">OpenAI</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">();</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">stream</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> client.responses.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">create</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  model: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"gpt-5.6"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      role: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"user"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">      content: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Say 'double bubble bath' ten times fast."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  stream: </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">true</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">for</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> (</span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">event</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">of</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> stream) {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(event);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r183R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from openai import OpenAI</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">client = OpenAI()</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">stream = client.responses.create(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    model="gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    input=[</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "role": "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">            "content": "Say 'double bubble bath' ten times fast.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        },</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    ],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    stream=True,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">for event in stream:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    print(event)</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r183R_1q_" tabindex="0"><code data-1p-ignore="true" data-language="go" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23</span></span><span class="syntax-highlighter-line"><span class="shiki-token">package main</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">import (</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"context"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"fmt"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	"github.com/openai/openai-go/v3/responses"</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">func main() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	client := openai.NewClient()</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	stream := client.Responses.NewStreaming(context.Background(), responses.ResponseNewParams{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Say 'double bubble bath' ten times fast.")},</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	})</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	for stream.Next() {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		fmt.Println(stream.Current().Type)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	if err := stream.Err(); err != nil {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">		panic(err)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">	}</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r183R_2a_" tabindex="0"><code data-1p-ignore="true" data-language="csharp" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18</span></span><span class="syntax-highlighter-line"><span class="shiki-token">using OpenAI.Responses;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">#pragma warning disable OPENAI001</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">ResponsesClient client = new(key);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">var responses = client.CreateResponseStreamingAsync(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    "Say 'double bubble bath' ten times fast."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">);</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">await foreach (StreamingResponseUpdate response in responses)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">{</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    if (response is StreamingResponseOutputTextDeltaUpdate delta)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">        Console.Write(delta.Delta);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">}</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r183R_2q_" tabindex="0"><code data-1p-ignore="true" data-language="ruby" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17</span></span><span class="syntax-highlighter-line"><span class="shiki-token">require "openai"</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">openai = OpenAI::Client.new</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">stream = openai.responses.stream(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  model: "gpt-5.6",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  input: [</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    {</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      role: "user",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">      content: "Say 'double bubble bath' ten times fast."</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    }</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  ]</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">stream.each do |event|</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">  puts(event)</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">end</span></span></code></pre></div></div></div></astro-island>
<a href="/api/docs/guides/streaming-responses" to="/api/docs/guides/streaming-responses" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M17.657 7.343a8 8 0 0 0-11.62 10.99 1 1 0 0 1-1.49 1.334C1.028 15.74 1.156 9.702 4.929 5.93c3.905-3.905 10.237-3.905 14.142 0 3.773 3.773 3.9 9.811.382 13.738a1 1 0 0 1-1.49-1.334 8 8 0 0 0-.306-10.99Z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M17.657 7.343a8 8 0 0 0-11.62 10.99 1 1 0 0 1-1.49 1.334C1.028 15.74 1.156 9.702 4.929 5.93c3.905-3.905 10.237-3.905 14.142 0 3.773 3.773 3.9 9.811.382 13.738a1 1 0 0 1-1.49-1.334 8 8 0 0 0-.306-10.99Z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M17.657 7.343a8 8 0 0 0-11.62 10.99 1 1 0 0 1-1.49 1.334C1.028 15.74 1.156 9.702 4.929 5.93c3.905-3.905 10.237-3.905 14.142 0 3.773 3.773 3.9 9.811.382 13.738a1 1 0 0 1-1.49-1.334 8 8 0 0 0-.306-10.99Z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M17.657 7.343a8 8 0 0 0-11.62 10.99 1 1 0 0 1-1.49 1.334C1.028 15.74 1.156 9.702 4.929 5.93c3.905-3.905 10.237-3.905 14.142 0 3.773 3.773 3.9 9.811.382 13.738a1 1 0 0 1-1.49-1.334 8 8 0 0 0-.306-10.99Z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M17.657 7.343a8 8 0 0 0-11.62 10.99 1 1 0 0 1-1.49 1.334C1.028 15.74 1.156 9.702 4.929 5.93c3.905-3.905 10.237-3.905 14.142 0 3.773 3.773 3.9 9.811.382 13.738a1 1 0 0 1-1.49-1.334 8 8 0 0 0-.306-10.99Z" clip-rule="evenodd"></path><path d="M10.362 14.853c1.203-1.718 3.765-3.675 5.2-4.698a.456.456 0 0 1 .713.5c-.471 1.697-1.434 4.775-2.636 6.492-.574.82-1.921 1.097-2.786.491-.864-.605-1.065-1.966-.491-2.785Z"></path><path d="M10.362 14.853c1.203-1.718 3.765-3.675 5.2-4.698a.456.456 0 0 1 .713.5c-.471 1.697-1.434 4.775-2.636 6.492-.574.82-1.921 1.097-2.786.491-.864-.605-1.065-1.966-.491-2.785Z"></path><path d="M10.362 14.853c1.203-1.718 3.765-3.675 5.2-4.698a.456.456 0 0 1 .713.5c-.471 1.697-1.434 4.775-2.636 6.492-.574.82-1.921 1.097-2.786.491-.864-.605-1.065-1.966-.491-2.785Z"></path><path d="M10.362 14.853c1.203-1.718 3.765-3.675 5.2-4.698a.456.456 0 0 1 .713.5c-.471 1.697-1.434 4.775-2.636 6.492-.574.82-1.921 1.097-2.786.491-.864-.605-1.065-1.966-.491-2.785Z"></path><path d="M10.362 14.853c1.203-1.718 3.765-3.675 5.2-4.698a.456.456 0 0 1 .713.5c-.471 1.697-1.434 4.775-2.636 6.492-.574.82-1.921 1.097-2.786.491-.864-.605-1.065-1.966-.491-2.785Z"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Use streaming events</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Use server-sent events to stream model responses to users fast.</p> </div> </div> </div></a>
<a href="/api/docs/guides/realtime" to="/api/docs/guides/realtime" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M15.24 3.486v.002l-1.056 4.517h5.823c1.726 0 2.596 2.021 1.518 3.3l-.002.003-9.308 10.965-.002.002c-1.397 1.656-3.922.223-3.454-1.76v-.003l1.057-4.517H3.993c-1.726 0-2.596-2.021-1.519-3.3l.003-.003 9.308-10.965.002-.002c1.397-1.656 3.922-.223 3.454 1.76Zm-1.95-.444-1.34 5.735a.998.998 0 0 0 .973 1.226h7.074a.04.04 0 0 1 .003.01.045.045 0 0 1-.004.005l-9.287 10.94 1.341-5.735a.998.998 0 0 0-.973-1.226H4.003a.041.041 0 0 1-.003-.01l.004-.005 9.287-10.94Z" clip-rule="evenodd"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Get started with the Realtime API</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Use WebRTC or WebSockets for super fast speech-to-speech AI apps.</p> </div> </div> </div></a>
<h2 id="build-agents" class="group flex items-center gap-2 mt-7 mb-2 scroll-mt-[110px] "><span class="min-w-0">Build agents</span><button type="button" class="shrink-0 self-center inline-flex items-center justify-center rounded-md p-0.5 opacity-0 transition-colors transition-opacity duration-200 ease-out text-info hover:text-info focus-visible:opacity-100 group-focus-within:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300 group-hover:opacity-100 dark:focus-visible:outline-gray-600 motion-reduce:transition-none relative -top-0.5" data-anchor-id="build-agents" aria-label="Copy link to build agents" title="Copy link to build agents"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 "><path d="M18.2929 5.7071C16.4743 3.88849 13.5257 3.88849 11.7071 5.7071L10.7071 6.7071C10.3166 7.09763 9.68341 7.09763 9.29289 6.7071C8.90236 6.31658 8.90236 5.68341 9.29289 5.29289L10.2929 4.29289C12.8926 1.69322 17.1074 1.69322 19.7071 4.29289C22.3068 6.89255 22.3068 11.1074 19.7071 13.7071L18.7071 14.7071C18.3166 15.0976 17.6834 15.0976 17.2929 14.7071C16.9024 14.3166 16.9024 13.6834 17.2929 13.2929L18.2929 12.2929C20.1115 10.4743 20.1115 7.52572 18.2929 5.7071ZM15.7071 8.29289C16.0976 8.68341 16.0976 9.31658 15.7071 9.7071L9.7071 15.7071C9.31658 16.0976 8.68341 16.0976 8.29289 15.7071C7.90236 15.3166 7.90236 14.6834 8.29289 14.2929L14.2929 8.29289C14.6834 7.90236 15.3166 7.90236 15.7071 8.29289ZM6.7071 9.29289C7.09763 9.68341 7.09763 10.3166 6.7071 10.7071L5.7071 11.7071C3.88849 13.5257 3.88849 16.4743 5.7071 18.2929C7.52572 20.1115 10.4743 20.1115 12.2929 18.2929L13.2929 17.2929C13.6834 16.9024 14.3166 16.9024 14.7071 17.2929C15.0976 17.6834 15.0976 18.3166 14.7071 18.7071L13.7071 19.7071C11.1074 22.3068 6.89255 22.3068 4.29289 19.7071C1.69322 17.1074 1.69322 12.8926 4.29289 10.2929L5.29289 9.29289C5.68341 8.90236 6.31658 8.90236 6.7071 9.29289Z" fill="currentColor"></path></svg></button></h2>
<p>Use the OpenAI platform to build <a href="/api/docs/guides/agents">agents</a> capable of taking action—like <a href="/api/docs/guides/tools-computer-use">controlling computers</a>—on behalf of your users. Use the <a href="/api/docs/guides/agents">Agents SDK</a> to create orchestration logic on your server.</p>
<astro-island uid="2b8fIE" prefix="r186" component-url="/_astro/QuickstartCodeSample.Dq8DGwXP.js" component-export="QuickstartCodeSample" renderer-url="/_astro/client.C28dYYSg.js" props="{&quot;title&quot;:[0,&quot;Build a language triage agent&quot;],&quot;highlighted&quot;:[0,true],&quot;defaultLanguage&quot;:[0,&quot;javascript&quot;],&quot;code&quot;:[0,{&quot;javascript&quot;:[0,&quot;import { Agent, run } from \&quot;@openai/agents\&quot;;\n\nconst spanishAgent = new Agent({\n  name: \&quot;Spanish agent\&quot;,\n  instructions: \&quot;You only speak Spanish.\&quot;,\n});\n\nconst englishAgent = new Agent({\n  name: \&quot;English agent\&quot;,\n  instructions: \&quot;You only speak English\&quot;,\n});\n\nconst triageAgent = new Agent({\n  name: \&quot;Triage agent\&quot;,\n  instructions:\n    \&quot;Handoff to the appropriate agent based on the language of the request.\&quot;,\n  handoffs: [spanishAgent, englishAgent],\n});\n\nconst result = await run(triageAgent, \&quot;Hola, ¿cómo estás?\&quot;);\nconsole.log(result.finalOutput);&quot;],&quot;python&quot;:[0,&quot;from agents import Agent, Runner\nimport asyncio\n\nspanish_agent = Agent(\n    name=\&quot;Spanish agent\&quot;,\n    instructions=\&quot;You only speak Spanish.\&quot;,\n)\n\nenglish_agent = Agent(\n    name=\&quot;English agent\&quot;,\n    instructions=\&quot;You only speak English\&quot;,\n)\n\ntriage_agent = Agent(\n    name=\&quot;Triage agent\&quot;,\n    instructions=\&quot;Handoff to the appropriate agent based on the language of the request.\&quot;,\n    handoffs=[spanish_agent, english_agent],\n)\n\n\nasync def main():\n    result = await Runner.run(triage_agent, input=\&quot;Hola, ¿cómo estás?\&quot;)\n    print(result.final_output)\n\n\nif __name__ == \&quot;__main__\&quot;:\n    asyncio.run(main())&quot;]}]}" client="load" opts="{&quot;name&quot;:&quot;QuickstartCodeSample&quot;,&quot;value&quot;:true}" await-children=""><div class="code-sample not-prose _root_1x2h7_2 light-mode"><div class="_header_1x2h7_34"><div class="_title_1x2h7_42 body-small">Build a language triage agent</div><div class="exclude-from-copy"><span class="_SelectControl_x887o_1" role="button" tabindex="0" data-variant="ghost" data-size="sm" data-selected="true" aria-disabled="false" id="select-trigger-_r186R_9_" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="radix-_r186R_1p_" data-state="closed"><span class="_TriggerText_x887o_510"><span id="_r186R_7p_">JavaScript</span></span><div class="_IndicatorWrapper_x887o_520"><svg width="1em" height="1em" viewBox="0 0 10 16" fill="currentColor" class="_DropdownIcon_x887o_475"><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></span></div><button type="button" class="_Button_6dmow_1 _copyButton_1x2h7_168" data-color="primary" data-variant="ghost" data-size="sm" data-gutter-size="xs" data-icon-size="sm" aria-label="Copy code"><span class="_ButtonInner_6dmow_4"><span class="block relative w-[var(--button-icon-size)] h-[var(--button-icon-size)]" data-transition-position="absolute" style="--tg-will-change:transform, opacity;--tg-enter-opacity:1;--tg-enter-transform:scale(1);--tg-enter-filter:none;--tg-enter-duration:300ms;--tg-enter-delay:150ms;--tg-enter-timing-function:var(--cubic-enter);--tg-exit-opacity:0;--tg-exit-transform:scale(0.6);--tg-exit-filter:none;--tg-exit-duration:150ms;--tg-exit-delay:0ms;--tg-exit-timing-function:var(--cubic-exit);--tg-initial-opacity:0;--tg-initial-transform:scale(0.6);--tg-initial-filter:none"><span class="_TransitionItem_1lpir_1 _TransitionGroupChild_1d6a5_1"><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z" fill="currentColor"></path></svg></span></span></span></button><span aria-live="polite" class="sr-only"></span></div><div class="_body_1x2h7_59 _bodySmall_1x2h7_151 _bodyWithHeader_1x2h7_139"><div class="code-block"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r186R_q_" tabindex="0"><code data-1p-ignore="true" data-language="javascript" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21</span></span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">import</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> { Agent, run } </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">from</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"@openai/agents"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">;</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">spanishAgent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Agent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  name: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Spanish agent"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  instructions: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"You only speak Spanish."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">englishAgent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Agent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  name: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"English agent"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  instructions: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"You only speak English"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">triageAgent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">new</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">Agent</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">({</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  name: </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Triage agent"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  instructions:</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">    </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Handoff to the appropriate agent based on the language of the request."</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">,</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">  handoffs: [spanishAgent, englishAgent],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">});</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">const</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#79B8FF;--shiki-light:#005CC5">result</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">=</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#F97583;--shiki-light:#D73A49">await</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> </span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">run</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(triageAgent, </span><span class="shiki-token" style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"Hola, ¿cómo estás?"</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">);</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">console.</span><span class="shiki-token" style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">log</span><span class="shiki-token" style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">(result.finalOutput);</span></span></code></pre></div><div class="code-block hidden"><pre class="shiki shiki-themes syntax-highlighter light-mode _pre_1x2h7_62" data-1p-ignore="true" data-copy-ignore="true" data-syntax-highlighter-id="_r186R_1a_" tabindex="0"><code data-1p-ignore="true" data-language="python" data-wrap-long-lines="false"><span aria-hidden="true" class="syntax-highlighter-line-numbers"><span class="syntax-highlighter-line-number">1<!-- -->
</span><span class="syntax-highlighter-line-number">2<!-- -->
</span><span class="syntax-highlighter-line-number">3<!-- -->
</span><span class="syntax-highlighter-line-number">4<!-- -->
</span><span class="syntax-highlighter-line-number">5<!-- -->
</span><span class="syntax-highlighter-line-number">6<!-- -->
</span><span class="syntax-highlighter-line-number">7<!-- -->
</span><span class="syntax-highlighter-line-number">8<!-- -->
</span><span class="syntax-highlighter-line-number">9<!-- -->
</span><span class="syntax-highlighter-line-number">10<!-- -->
</span><span class="syntax-highlighter-line-number">11<!-- -->
</span><span class="syntax-highlighter-line-number">12<!-- -->
</span><span class="syntax-highlighter-line-number">13<!-- -->
</span><span class="syntax-highlighter-line-number">14<!-- -->
</span><span class="syntax-highlighter-line-number">15<!-- -->
</span><span class="syntax-highlighter-line-number">16<!-- -->
</span><span class="syntax-highlighter-line-number">17<!-- -->
</span><span class="syntax-highlighter-line-number">18<!-- -->
</span><span class="syntax-highlighter-line-number">19<!-- -->
</span><span class="syntax-highlighter-line-number">20<!-- -->
</span><span class="syntax-highlighter-line-number">21<!-- -->
</span><span class="syntax-highlighter-line-number">22<!-- -->
</span><span class="syntax-highlighter-line-number">23<!-- -->
</span><span class="syntax-highlighter-line-number">24<!-- -->
</span><span class="syntax-highlighter-line-number">25<!-- -->
</span><span class="syntax-highlighter-line-number">26<!-- -->
</span><span class="syntax-highlighter-line-number">27</span></span><span class="syntax-highlighter-line"><span class="shiki-token">from agents import Agent, Runner</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">import asyncio</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">spanish_agent = Agent(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    name="Spanish agent",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    instructions="You only speak Spanish.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">english_agent = Agent(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    name="English agent",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    instructions="You only speak English",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">triage_agent = Agent(</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    name="Triage agent",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    instructions="Handoff to the appropriate agent based on the language of the request.",</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    handoffs=[spanish_agent, english_agent],</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">async def main():</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    print(result.final_output)</span>
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line">
</span><span class="syntax-highlighter-line"><span class="shiki-token">if __name__ == "__main__":</span>
</span><span class="syntax-highlighter-line"><span class="shiki-token">    asyncio.run(main())</span></span></code></pre></div></div></div></astro-island>
<a href="/api/docs/guides/agents" to="/api/docs/guides/agents" class="_TextLink_ssta1_1" data-underline="always"><div class="icon-item mt-2"> <div class="icon-item-icon"> <span><svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor"><path d="M11 7.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM14.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path fill-rule="evenodd" d="M12 1a1 1 0 0 1 1 1v.5h4a3 3 0 0 1 3 3V9a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V5.5a3 3 0 0 1 3-3h4V2a1 1 0 0 1 1-1ZM7 4.5h10a1 1 0 0 1 1 1V9a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V5.5a1 1 0 0 1 1-1Z" clip-rule="evenodd"></path><path d="M6 21c0-.974.551-1.95 1.632-2.722C8.71 17.508 10.252 17 12 17c1.749 0 3.29.508 4.369 1.278C17.449 19.05 18 20.026 18 21a1 1 0 1 0 2 0c0-1.788-1.016-3.311-2.469-4.35-1.455-1.038-3.414-1.65-5.53-1.65-2.118 0-4.077.611-5.532 1.65C5.016 17.69 4 19.214 4 21a1 1 0 1 0 2 0Z"></path></svg></span> </div> <div class="icon-item-right"> <div class="icon-item-title not-prose"> <div class="icon-item-title body-large not-prose">Build agents that can take action</div> <div class="pointer"> <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M9.293 7.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L12.586 12 9.293 8.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"></path></svg> </div> </div>  <div class="icon-item-desc body-small not-prose"> <p>Learn how to use the OpenAI platform to build powerful, capable AI agents.</p> </div> </div> </div></a>  </article>  </div> </div> </div> <script data-astro-exec="">
    const copyHeadingLink = async (slug) => {
      const url = `${location.origin}${location.pathname}${location.search}#${slug}`;
      if (navigator.clipboard && navigator.clipboard.writeText) {
        try {
          await navigator.clipboard.writeText(url);
          return;
        } catch (error) {
          console.warn("Copy to clipboard failed", error);
        }
      }

      window.prompt("Copy link", url);
    };

    document.addEventListener("click", (event) => {
      const target = event.target;
      if (!(target instanceof Element)) return;

      const button = target.closest("[data-anchor-id]");
      if (!button) return;

      const slug = button.getAttribute("data-anchor-id");
      if (!slug) return;

      event.preventDefault();
      copyHeadingLink(slug);
      const headings = Array.from(document.querySelectorAll("[id]")).filter(
        (candidate) => candidate.id === slug
      );
      const heading =
        headings.find((candidate) => !candidate.closest("[hidden]")) ??
        headings[0];
      if (heading) {
        heading.scrollIntoView({ behavior: "smooth", block: "start" });
      }
      history.replaceState(null, "", `#${slug}`);
    });
  </script>  <div class="mx-4 sm:mx-8 md:mx-auto md:w-full md:max-w-6xl px-4 md:px-12 xl:px-4"> <div class="grid grid-cols-1 gap-12 xl:grid-cols-[minmax(0,1fr)_200px]"> <nav class="w-full mb-8 px-0"><div class="flex justify-between items-center"><span></span><a href="/api/docs/guides/latest-model" class="flex items-end gap-2"><div class="flex flex-col"><div class="text-xs font-bold text-gray-800 dark:text-gray-200">
Next
</div><div class="text-sm text-gray-500 dark:text-gray-400">Using GPT-5.6</div></div><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-3 h-3 text-gray-800 dark:text-gray-200 mb-1 "><path d="M21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071L13.7071 19.7071C13.3166 20.0976 12.6834 20.0976 12.2929 19.7071C11.9024 19.3166 11.9024 18.6834 12.2929 18.2929L17.5858 13H4C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11L17.5858 11L12.2929 5.70711C11.9024 5.31658 11.9024 4.68342 12.2929 4.29289C12.6834 3.90237 13.3166 3.90237 13.7071 4.29289L20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12Z" fill="currentColor"></path></svg></a></div></nav> <div class="hidden xl:block"></div> </div> </div> </main> </div> </div> <script data-astro-exec="">(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event("astro:only"));})();</script><astro-island uid="DQ4jb" component-url="/_astro/Analytics.BkQu9XS9.js" component-export="default" renderer-url="/_astro/client.CNnMPaG9.js" props="{}" client="only" opts="{&quot;name&quot;:&quot;VercelAnalyticsClient&quot;,&quot;value&quot;:&quot;solid-js&quot;}"></astro-island> <vercel-speed-insights data-props="{}" data-params="{&quot;slug&quot;:&quot;quickstart&quot;}" data-pathname="/api/docs/quickstart/"></vercel-speed-insights> <script type="module" data-astro-exec="">var o="@vercel/speed-insights",u="1.3.1",f=()=>{window.si||(window.si=function(...r){(window.siq=window.siq||[]).push(r)})};function l(){return typeof window<"u"}function h(){try{const e="production"}catch{}return"production"}function d(){return h()==="development"}function v(e,r){if(!e||!r)return e;let n=e;try{const t=Object.entries(r);for(const[s,i]of t)if(!Array.isArray(i)){const a=c(i);a.test(n)&&(n=n.replace(a,`/[${s}]`))}for(const[s,i]of t)if(Array.isArray(i)){const a=c(i.join("/"));a.test(n)&&(n=n.replace(a,`/[...${s}]`))}return n}catch{return e}}function c(e){return new RegExp(`/${g(e)}(?=[/?#]|$)`)}function g(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){return e.scriptSrc?e.scriptSrc:d()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":e.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":e.basePath?`${e.basePath}/speed-insights/script.js`:"/_vercel/speed-insights/script.js"}function w(e={}){var r;if(!l()||e.route===null)return null;f();const n=m(e);if(document.head.querySelector(`script[src*="${n}"]`))return null;e.beforeSend&&((r=window.si)==null||r.call(window,"beforeSend",e.beforeSend));const t=document.createElement("script");return t.src=n,t.defer=!0,t.dataset.sdkn=o+(e.framework?`/${e.framework}`:""),t.dataset.sdkv=u,e.sampleRate&&(t.dataset.sampleRate=e.sampleRate.toString()),e.route&&(t.dataset.route=e.route),e.endpoint?t.dataset.endpoint=e.endpoint:e.basePath&&(t.dataset.endpoint=`${e.basePath}/speed-insights/vitals`),e.dsn&&(t.dataset.dsn=e.dsn),d()&&e.debug===!1&&(t.dataset.debug="false"),t.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${n}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(t),{setRoute:s=>{t.dataset.route=s??void 0}}}function p(){try{return}catch{}}customElements.define("vercel-speed-insights",class extends HTMLElement{constructor(){super();try{const r=JSON.parse(this.dataset.props??"{}"),n=JSON.parse(this.dataset.params??"{}"),t=v(this.dataset.pathname??"",n);w({route:t,...r,framework:"astro",basePath:p(),beforeSend:window.speedInsightsBeforeSend})}catch(r){throw new Error(`Failed to parse SpeedInsights properties: ${r}`)}}});</script> <div data-docs-agent-root="" data-chatkit-api-url="/api/docs-agent/chatkit" data-chatkit-domain-key="domain_pk_69f4ea0d87748194b9ad4d8ba39fc5710f6f8241026056cb" data-docs-agent-site-domain="developers" data-chatkit-greeting="What can I help you with?" data-chatkit-start-prompts-by-route="{&quot;home&quot;:[{&quot;label&quot;:&quot;Ask a question&quot;,&quot;prompt&quot;:&quot;What is the Docs MCP server?&quot;,&quot;icon&quot;:&quot;circle-question&quot;},{&quot;label&quot;:&quot;Find a page&quot;,&quot;prompt&quot;:&quot;Show me OpenAI models&quot;,&quot;icon&quot;:&quot;search&quot;},{&quot;label&quot;:&quot;Build a custom guide&quot;,&quot;prompt&quot;:&quot;I want to build an interactive webapp that has a huge microphone in the center allowing to chat in Realtime&quot;,&quot;icon&quot;:&quot;square-code&quot;}],&quot;api&quot;:[{&quot;label&quot;:&quot;Ask a question&quot;,&quot;prompt&quot;:&quot;What are the recommended prompting best practices for building with the latest model?&quot;,&quot;icon&quot;:&quot;circle-question&quot;},{&quot;label&quot;:&quot;Find a page&quot;,&quot;prompt&quot;:&quot;show me a page to compare models&quot;,&quot;icon&quot;:&quot;search&quot;},{&quot;label&quot;:&quot;Build a custom guide&quot;,&quot;prompt&quot;:&quot;I want to build a customer support app with realtime voice&quot;,&quot;icon&quot;:&quot;square-code&quot;}],&quot;codex&quot;:[{&quot;label&quot;:&quot;Ask a question&quot;,&quot;prompt&quot;:&quot;What's the latest model to use with ChatGPT?&quot;,&quot;icon&quot;:&quot;circle-question&quot;},{&quot;label&quot;:&quot;Find a page&quot;,&quot;prompt&quot;:&quot;Do you have guidance on prompting?&quot;,&quot;icon&quot;:&quot;search&quot;},{&quot;label&quot;:&quot;Build a custom guide&quot;,&quot;prompt&quot;:&quot;I want to build an internal dashboard that gets updated with data from slack and spreadsheets and which allows to visualize weekly progress&quot;,&quot;icon&quot;:&quot;square-code&quot;}],&quot;chatgpt&quot;:[{&quot;label&quot;:&quot;Ask a question&quot;,&quot;prompt&quot;:&quot;What are best practices for building a plugin?&quot;,&quot;icon&quot;:&quot;circle-question&quot;},{&quot;label&quot;:&quot;Find a page&quot;,&quot;prompt&quot;:&quot;Show me the optional UI guidelines for plugins&quot;,&quot;icon&quot;:&quot;search&quot;},{&quot;label&quot;:&quot;Build a custom guide&quot;,&quot;prompt&quot;:&quot;Help me build a plugin that proposes a quiz to find the best match from my list of products&quot;,&quot;icon&quot;:&quot;square-code&quot;}],&quot;resources&quot;:[{&quot;label&quot;:&quot;Ask a question&quot;,&quot;prompt&quot;:&quot;What is the Docs MCP server?&quot;,&quot;icon&quot;:&quot;circle-question&quot;},{&quot;label&quot;:&quot;Find a page&quot;,&quot;prompt&quot;:&quot;Show me the Codex meetups page&quot;,&quot;icon&quot;:&quot;search&quot;},{&quot;label&quot;:&quot;Build a custom guide&quot;,&quot;prompt&quot;:&quot;I want to build an interactive webapp that has a huge microphone in the center allowing to chat in Realtime&quot;,&quot;icon&quot;:&quot;square-code&quot;}]}" data-astro-transition-persist="docs-agent-launcher" class="docs-agent-root" data-initialized="true"><button type="button" data-docs-agent-open="" aria-haspopup="dialog" aria-expanded="false" aria-controls="docs-agent-panel" class="fixed bottom-5 right-5 z-50 inline-flex h-11 items-center justify-center whitespace-nowrap rounded-full border border-transparent bg-primary-solid px-4 text-sm font-medium text-primary-solid shadow-[0_16px_48px_-18px_rgba(15,23,42,0.45)] transition-colors hover:bg-primary-solid-hover active:bg-primary-solid-active focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-soft-active focus-visible:ring-offset-2 focus-visible:ring-offset-surface"><span>Ask AI</span></button><div id="docs-agent-panel" data-docs-agent-panel="" role="dialog" aria-labelledby="docs-agent-title" class="fixed inset-x-0 bottom-0 z-[80] flex h-[var(--docs-agent-drawer-height)] flex-col overflow-hidden rounded-t-2xl border border-subtle bg-surface transition-transform duration-300 ease-out md:inset-y-0 md:left-auto md:right-0 md:h-auto md:w-[var(--docs-agent-panel-width)] md:rounded-none md:border-y-0 md:border-r-0"><header class="flex h-16 shrink-0 items-center justify-between border-b border-subtle px-4"><h2 id="docs-agent-title" class="text-sm font-semibold text-default">
Docs agent
</h2><div class="flex items-center gap-1.5"><button type="button" data-docs-agent-new="" aria-label="Start a new docs agent chat" title="Start a new chat" class="inline-flex h-8 w-8 items-center justify-center rounded-md text-secondary transition-colors hover:bg-primary-soft-alpha hover:text-default"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24" class="h-4 w-4 "><path fill-rule="evenodd" d="M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z" clip-rule="evenodd"></path></svg></button><button type="button" data-docs-agent-close="" aria-label="Close docs agent" class="inline-flex h-8 w-8 items-center justify-center rounded-md text-secondary transition-colors hover:bg-primary-soft-alpha hover:text-default"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 "><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></button></div></header><div class="relative min-h-0 flex-1"><p data-docs-agent-status="" class="absolute inset-x-4 top-4 rounded-lg border border-subtle bg-surface-secondary p-3 text-sm text-secondary">
Loading docs agent...
</p><openai-chatkit id="docs-agent-chatkit" class="block h-full w-full"></openai-chatkit></div></div></div><script data-astro-exec="">(() => {
  const registry = window.customElements;
  if (!registry || window.__docsAgentChatKitMoveGuardInstalled) return;
  window.__docsAgentChatKitMoveGuardInstalled = true;

  // Astro preserves the launcher with Element.moveBefore(). Registering this
  // callback before ChatKit is defined prevents its reconnect hooks from
  // replacing the live message-bridge iframe during that move.
  const registryPrototype = Object.getPrototypeOf(registry);
  const defineDescriptor = Object.getOwnPropertyDescriptor(
    registryPrototype,
    "define"
  );
  if (!defineDescriptor?.value) return;

  Object.defineProperty(registryPrototype, "define", {
    ...defineDescriptor,
    value(name, constructor, options) {
      if (
        name === "openai-chatkit" &&
        !("connectedMoveCallback" in constructor.prototype)
      ) {
        Object.defineProperty(
          constructor.prototype,
          "connectedMoveCallback",
          {
            configurable: true,
            value() {},
          }
        );
      }

      const result = defineDescriptor.value.call(
        this,
        name,
        constructor,
        options
      );
      if (name === "openai-chatkit") {
        Object.defineProperty(registryPrototype, "define", defineDescriptor);
      }
      return result;
    },
  });
})();</script><script src="https://cdn.platform.openai.com/deployments/chatkit/chatkit.js" async="" data-astro-exec=""></script><script type="module" src="/_astro/DocsAgentLauncher.astro_astro_type_script_index_0_lang.Dte2V6Xo.js" data-astro-exec=""></script><script data-astro-exec="">
  function initializeDocsAgentLauncher() {
    const root = document.querySelector("[data-docs-agent-root]");
    if (!root || root.dataset.initialized === "true") return;
    if (
      typeof window.__createDocsAgentNavigationQueue !== "function" ||
      typeof window.__getDocsAgentNavigationTarget !== "function"
    ) {
      return;
    }

    const mobileOpenButton = root.querySelector("button[data-docs-agent-open]");
    const closeButton = root.querySelector("[data-docs-agent-close]");
    const newButton = root.querySelector("[data-docs-agent-new]");
    const panel = root.querySelector("[data-docs-agent-panel]");
    const status = root.querySelector("[data-docs-agent-status]");
    let chatkit = root.querySelector("openai-chatkit");
    const apiURL = root.dataset.chatkitApiUrl;
    const domainKey = root.dataset.chatkitDomainKey || "local-dev";
    const siteDomain =
      root.dataset.docsAgentSiteDomain === "chatgpt" ? "chatgpt" : "developers";
    const startGreeting =
      root.dataset.chatkitGreeting || "OpenAI developer docs";
    const startPromptsByParentRoute = (() => {
      try {
        const parsed = JSON.parse(
          root.dataset.chatkitStartPromptsByRoute || "{}"
        );
        return parsed && typeof parsed === "object" && !Array.isArray(parsed)
          ? parsed
          : {};
      } catch {
        return {};
      }
    })();
    const docsAgentSessionStorageKey = "docs-agent.chatkit-session-id";
    const uuidPattern =
      /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

    const randomUuid = () => {
      if (window.crypto?.randomUUID) {
        return window.crypto.randomUUID();
      }

      const bytes = new Uint8Array(16);
      if (window.crypto?.getRandomValues) {
        window.crypto.getRandomValues(bytes);
      } else {
        for (let index = 0; index < bytes.length; index += 1) {
          bytes[index] = Math.floor(Math.random() * 256);
        }
      }
      bytes[6] = (bytes[6] & 0x0f) | 0x40;
      bytes[8] = (bytes[8] & 0x3f) | 0x80;

      const hex = Array.from(bytes, (byte) =>
        byte.toString(16).padStart(2, "0")
      );
      return [
        hex.slice(0, 4).join(""),
        hex.slice(4, 6).join(""),
        hex.slice(6, 8).join(""),
        hex.slice(8, 10).join(""),
        hex.slice(10, 16).join(""),
      ].join("-");
    };

    let docsAgentSessionIdValue = null;

    const storeDocsAgentSessionId = (sessionId) => {
      docsAgentSessionIdValue = sessionId;
      try {
        window.sessionStorage.setItem(docsAgentSessionStorageKey, sessionId);
      } catch {
        // Ignore storage failures.
      }
      return sessionId;
    };

    const resetDocsAgentSessionId = () =>
      storeDocsAgentSessionId(randomUuid().toLowerCase());

    const docsAgentSessionId = () => {
      if (
        docsAgentSessionIdValue &&
        uuidPattern.test(docsAgentSessionIdValue)
      ) {
        return docsAgentSessionIdValue.toLowerCase();
      }
      try {
        const stored = window.sessionStorage.getItem(
          docsAgentSessionStorageKey
        );
        if (stored && uuidPattern.test(stored)) {
          docsAgentSessionIdValue = stored.toLowerCase();
          return docsAgentSessionIdValue;
        }
      } catch {
        // Fall through and create an in-memory session id.
      }
      return resetDocsAgentSessionId();
    };

    if (
      !mobileOpenButton ||
      !closeButton ||
      !newButton ||
      !(panel instanceof HTMLElement) ||
      !chatkit ||
      !apiURL
    ) {
      return;
    }

    let chatkitInitialized = false;
    let chatkitResponseActive = false;
    let chatkitTurnActive = false;
    let docsAgentNavigationInProgress = false;
    let chatkitReplacement = null;
    let desiredPathname = window.location.pathname || "/";
    let previousFocus = null;
    let lastPageSelection = { text: "", capturedAt: 0 };
    let conversationStartedTracked = false;

    const selectedTextLimit = 3000;
    const staleSelectionMs = 2 * 60 * 1000;
    const docsAgentRequestTimeoutMs = 40 * 1000;
    const docsAgentNavigationTimeoutMs = 8 * 1000;
    const docsAgentTransitionWaitTimeoutMs = 15 * 1000;
    const docsAgentInitializationTimeoutMs = 15 * 1000;
    const docsAgentUnavailableMessage =
      "The docs agent couldn't complete the request. Please retry.";
    const chatKitUserTurnTypes = new Set([
      "threads.create",
      "threads.add_user_message",
      "threads.retry_after_item",
    ]);
    const desktopPanelMedia = window.matchMedia("(min-width: 768px)");

    const withTimeout = (operation, timeoutMs, message) =>
      new Promise((resolve, reject) => {
        const timeout = window.setTimeout(
          () => reject(new Error(message)),
          timeoutMs
        );
        Promise.resolve(operation).then(
          (value) => {
            window.clearTimeout(timeout);
            resolve(value);
          },
          (error) => {
            window.clearTimeout(timeout);
            reject(error);
          }
        );
      });

    const requestDeadlineSignal = (existingSignal) => {
      const controller = new AbortController();
      const abort = (signal) => controller.abort(signal?.reason);
      if (existingSignal) {
        if (existingSignal.aborted) {
          abort(existingSignal);
        } else {
          existingSignal.addEventListener(
            "abort",
            () => abort(existingSignal),
            {
              once: true,
            }
          );
        }
      }
      window.setTimeout(
        () => controller.abort(new Error("Docs agent request timed out")),
        docsAgentRequestTimeoutMs
      );
      return controller.signal;
    };

    const chatKitErrorFrame = (message = docsAgentUnavailableMessage) =>
      new TextEncoder().encode(
        `data: ${JSON.stringify({
          type: "error",
          code: "custom",
          message,
          allow_retry: true,
        })}\n\n`
      );

    const chatKitErrorResponse = (message = docsAgentUnavailableMessage) =>
      new Response(chatKitErrorFrame(message), {
        status: 200,
        headers: {
          "content-type": "text/event-stream; charset=utf-8",
          "cache-control": "no-cache",
        },
      });

    const chatKitFrameHasTerminalEvent = (frame) => {
      const data = frame
        .split("\n")
        .filter((line) => line.startsWith("data: "))
        .map((line) => line.slice("data: ".length))
        .join("\n");
      if (!data) return false;
      try {
        const payload = JSON.parse(data);
        if (payload?.type === "error") return true;
        return (
          payload?.type === "thread.item.done" &&
          payload?.item?.type === "assistant_message" &&
          Array.isArray(payload.item.content) &&
          payload.item.content.some(
            (part) =>
              typeof part?.text === "string" && Boolean(part.text.trim())
          )
        );
      } catch {
        return false;
      }
    };

    const observeChatKitTerminalEvents = (state, chunk, final = false) => {
      state.buffer += chunk
        ? state.decoder.decode(chunk, { stream: !final })
        : state.decoder.decode();
      state.buffer = state.buffer.replace(/\r\n/g, "\n");
      const frames = state.buffer.split("\n\n");
      const trailingFrame = frames.pop() || "";
      state.buffer = final ? "" : trailingFrame;
      for (const frame of frames) {
        if (chatKitFrameHasTerminalEvent(frame)) state.emitted = true;
      }
      if (
        final &&
        trailingFrame &&
        chatKitFrameHasTerminalEvent(trailingFrame)
      ) {
        state.emitted = true;
      }
    };

    const ensureUserTurnTerminalResponse = (response) => {
      if (!response.body) return chatKitErrorResponse();
      const reader = response.body.getReader();
      const state = {
        decoder: new TextDecoder(),
        buffer: "",
        emitted: false,
      };
      const body = new ReadableStream({
        async pull(controller) {
          try {
            const result = await reader.read();
            if (result.done) {
              observeChatKitTerminalEvents(state, null, true);
              if (!state.emitted) controller.enqueue(chatKitErrorFrame());
              controller.close();
              return;
            }
            observeChatKitTerminalEvents(state, result.value);
            controller.enqueue(result.value);
          } catch {
            if (!state.emitted) controller.enqueue(chatKitErrorFrame());
            controller.close();
          }
        },
        cancel(reason) {
          void reader.cancel(reason).catch(() => undefined);
        },
      });
      return new Response(body, {
        status: response.status,
        statusText: response.statusText,
        headers: response.headers,
      });
    };
    const syncOpenButtons = (expanded) => {
      document
        .querySelectorAll("button[data-docs-agent-open]")
        .forEach((button) => {
          button.setAttribute("aria-expanded", expanded);
        });
    };

    const syncLayoutTargets = () => {
      const isOpen = root.dataset.open === "true";
      const isDesktopPanel = desktopPanelMedia.matches;
      document.body.classList.toggle("docs-agent-open", isOpen);
      if (isOpen) {
        document.body.dataset.docsAgentOpen = "true";
      } else {
        delete document.body.dataset.docsAgentOpen;
      }
      syncOpenButtons(isOpen ? "true" : "false");
      document.querySelectorAll("[data-docs-agent-page]").forEach((page) => {
        if (page instanceof HTMLElement) {
          page.classList.toggle("is-docs-agent-open", isOpen);
          page.style.width =
            isOpen && isDesktopPanel
              ? "calc(100% - var(--docs-agent-panel-width))"
              : "";
          page.style.transform = isOpen
            ? isDesktopPanel
              ? "none"
              : "translateY(calc(-1 * var(--docs-agent-drawer-height)))"
            : "";
        }
      });

      const header = document.getElementById("header");
      header?.classList.toggle("is-docs-agent-open", isOpen);
      if (header) {
        const headerInner = header.firstElementChild;
        const headerNav = header.querySelector("nav");
        const headerSearchButton = header.querySelector(
          "[data-header-search-button]"
        );
        header.style.width =
          isOpen && isDesktopPanel
            ? "calc(100% - var(--docs-agent-panel-width))"
            : "";
        if (headerInner instanceof HTMLElement) {
          headerInner.style.gridTemplateColumns =
            isOpen && isDesktopPanel ? "auto minmax(0, 1fr) auto" : "";
        }
        if (headerNav instanceof HTMLElement) {
          headerNav.style.minWidth = isOpen && isDesktopPanel ? "0" : "";
          headerNav.style.overflow = "";
        }
        if (headerSearchButton instanceof HTMLElement) {
          headerSearchButton.style.display =
            isOpen && isDesktopPanel ? "none" : "";
        }

        const leadingControls = headerNav?.previousElementSibling;
        const trailingControls = headerNav?.nextElementSibling;
        const marginBoxWidth = (element) => {
          const styles = window.getComputedStyle(element);
          const horizontalMargin =
            (Number.parseFloat(styles.marginLeft) || 0) +
            (Number.parseFloat(styles.marginRight) || 0);
          return element.getBoundingClientRect().width + horizontalMargin;
        };
        const contextSubnavOffset =
          isOpen &&
          isDesktopPanel &&
          leadingControls instanceof HTMLElement &&
          trailingControls instanceof HTMLElement
            ? (marginBoxWidth(leadingControls) -
                marginBoxWidth(trailingControls)) /
              2
            : 0;
        document.documentElement.style.setProperty(
          "--docs-agent-context-subnav-offset",
          `${contextSubnavOffset}px`
        );
      }

      panel.classList.toggle("is-open", isOpen);
      panel.style.transform = isOpen
        ? isDesktopPanel
          ? "translateX(0)"
          : "translateY(0)"
        : "";
    };

    const normalizeAnalyticsText = (value) =>
      typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";

    const analyticsSlug = (value, fallback) => {
      const slug = normalizeAnalyticsText(value)
        .toLowerCase()
        .replace(/[^a-z0-9]+/g, "_")
        .replace(/^_+|_+$/g, "");
      return slug || fallback;
    };

    const normalizePathname = (pathname) => {
      if (!pathname || pathname === "/") return "/";
      return pathname.replace(/\/+$/, "") || "/";
    };

    const docsAgentParentRoute = (pathname) => {
      const normalized = normalizePathname(pathname);

      if (normalized === "/") return "home";
      if (normalized === "/api" || normalized.startsWith("/api/")) {
        return "api";
      }
      if (normalized === "/codex" || normalized.startsWith("/codex/")) {
        return "codex";
      }
      if (
        normalized === "/docs" ||
        normalized.startsWith("/docs/") ||
        normalized === "/use-cases" ||
        normalized.startsWith("/use-cases/")
      ) {
        return "codex";
      }
      if (
        normalized === "/chatgpt" ||
        normalized.startsWith("/chatgpt/") ||
        normalized === "/plugins" ||
        normalized.startsWith("/plugins/") ||
        normalized === "/commerce" ||
        normalized.startsWith("/commerce/")
      ) {
        return "chatgpt";
      }
      if (
        normalized === "/learn" ||
        normalized.startsWith("/learn/") ||
        normalized === "/community" ||
        normalized.startsWith("/community/") ||
        normalized === "/cookbook" ||
        normalized.startsWith("/cookbook/") ||
        normalized === "/showcase" ||
        normalized.startsWith("/showcase/") ||
        normalized === "/tracks" ||
        normalized.startsWith("/tracks/") ||
        normalized === "/blog" ||
        normalized.startsWith("/blog/")
      ) {
        return "resources";
      }

      return "home";
    };

    const startPromptsForRoute = (
      pathname = window.location.pathname || "/"
    ) => {
      const parentRoute = docsAgentParentRoute(pathname);
      const prompts = startPromptsByParentRoute[parentRoute];

      if (Array.isArray(prompts)) return prompts;
      return Array.isArray(startPromptsByParentRoute.home)
        ? startPromptsByParentRoute.home
        : [];
    };

    const startPromptAnalyticsForRoute = (pathname) =>
      startPromptsForRoute(pathname)
        .map((prompt, index) => {
          const promptText = normalizeAnalyticsText(prompt?.prompt);
          if (!promptText) return null;
          return {
            id: analyticsSlug(prompt?.label, `prompt_${index + 1}`),
            label:
              normalizeAnalyticsText(prompt?.label) || `Prompt ${index + 1}`,
            position: index + 1,
            text: promptText,
          };
        })
        .filter(Boolean);

    const normalizeSelectedText = (value) =>
      value.replace(/\r\n?/g, "\n").trim().slice(0, selectedTextLimit);

    const nodeIsInDocsAgent = (node) => {
      if (!node) return false;
      const element =
        node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement;
      return element instanceof Element && root.contains(element);
    };

    const currentPageSelectionText = () => {
      const selection = window.getSelection?.();
      if (!selection || selection.isCollapsed) return "";
      if (
        nodeIsInDocsAgent(selection.anchorNode) ||
        nodeIsInDocsAgent(selection.focusNode)
      ) {
        return "";
      }

      return normalizeSelectedText(selection.toString());
    };

    const rememberPageSelection = () => {
      const text = currentPageSelectionText();
      if (!text) return;
      lastPageSelection = {
        text,
        capturedAt: Date.now(),
      };
    };

    const selectedTextForAgentContext = () => {
      const text = currentPageSelectionText();
      if (text) {
        lastPageSelection = {
          text,
          capturedAt: Date.now(),
        };
        return text;
      }

      if (Date.now() - lastPageSelection.capturedAt <= staleSelectionMs) {
        return lastPageSelection.text;
      }
      return "";
    };

    const docsAgentPageContext = () => {
      const context = {
        route: `${window.location.pathname || "/"}${window.location.search}`,
        siteDomain,
      };
      const selectedText = selectedTextForAgentContext();
      if (selectedText) {
        context.selectedText = selectedText;
      }
      return context;
    };

    const hasPageSelectionForAnalytics = () => {
      if (currentPageSelectionText()) return true;
      return Date.now() - lastPageSelection.capturedAt <= staleSelectionMs
        ? Boolean(lastPageSelection.text)
        : false;
    };

    const chatKitRequestInputText = (body) => {
      const content = body?.params?.input?.content;
      if (!Array.isArray(content)) return "";

      return content
        .map((part) =>
          part?.type === "input_text" && typeof part.text === "string"
            ? part.text
            : ""
        )
        .filter(Boolean)
        .join("\n")
        .trim();
    };

    const defaultPromptMatch = (body) => {
      const text = normalizeAnalyticsText(chatKitRequestInputText(body));
      if (!text) return null;

      const startPromptByText = new Map(
        startPromptAnalyticsForRoute(window.location.pathname || "/").map(
          (prompt) => [prompt.text, prompt]
        )
      );
      return startPromptByText.get(text) || null;
    };

    const promptAnalyticsData = (prompt) =>
      prompt
        ? {
            prompt_id: prompt.id,
            prompt_label: prompt.label,
            prompt_position: prompt.position,
          }
        : {};

    const isDocsAgentApiRequest = (input) => {
      try {
        const requestUrl =
          typeof input === "string" || input instanceof URL
            ? new URL(input, window.location.href)
            : new URL(input.url);
        const configuredUrl = new URL(apiURL, window.location.href);
        return requestUrl.href === configuredUrl.href;
      } catch {
        return false;
      }
    };

    const docsAgentFetch = async (input, init) => {
      if (!isDocsAgentApiRequest(input)) {
        return window.fetch(input, init);
      }

      const nextInit = init ? { ...init } : {};
      if (typeof nextInit.body === "string") {
        try {
          const body = JSON.parse(nextInit.body);
          if (body && typeof body === "object" && !Array.isArray(body)) {
            if (body.type === "threads.create" && !conversationStartedTracked) {
              const prompt = defaultPromptMatch(body);
              const promptData = promptAnalyticsData(prompt);
              conversationStartedTracked = true;
              trackDocsAgentEvent("docs_agent_conversation_started", {
                entry_point: prompt ? "default_prompt" : "composer",
                request_type: body.type,
                has_page_selection: hasPageSelectionForAnalytics(),
                ...promptData,
              });
              if (prompt) {
                trackDocsAgentEvent("docs_agent_default_prompt_selected", {
                  request_type: body.type,
                  ...promptData,
                });
              }
            }

            const metadata =
              body.metadata &&
              typeof body.metadata === "object" &&
              !Array.isArray(body.metadata)
                ? body.metadata
                : {};
            body.metadata = {
              ...metadata,
              pageContext: docsAgentPageContext(),
            };
            nextInit.body = JSON.stringify(body);
          }
        } catch {
          // Preserve the original body if it is not JSON.
        }
      }

      const headers = new Headers(
        nextInit.headers ||
          (input instanceof Request ? input.headers : undefined)
      );
      headers.set("x-docs-agent-user", docsAgentSessionId());
      nextInit.headers = headers;
      nextInit.signal = requestDeadlineSignal(
        nextInit.signal || (input instanceof Request ? input.signal : null)
      );

      let requestType = "";
      if (typeof nextInit.body === "string") {
        try {
          requestType = JSON.parse(nextInit.body)?.type || "";
        } catch {
          // The proxy will return the protocol validation error.
        }
      }
      const requireTerminalEvent = chatKitUserTurnTypes.has(requestType);
      if (requireTerminalEvent) {
        chatkitTurnActive = true;
      }

      try {
        const response = await window.fetch(input, nextInit);
        return requireTerminalEvent
          ? ensureUserTurnTerminalResponse(response)
          : response;
      } catch (error) {
        if (requireTerminalEvent) return chatKitErrorResponse();
        throw error;
      }
    };

    const clearLegacyStoredState = () => {
      try {
        window.localStorage.removeItem("docs-agent.panel-open");
        window.localStorage.removeItem("docs-agent.thread-id");
        window.localStorage.removeItem("docs-agent.user-id");
      } catch {
        // Ignore storage failures.
      }
    };

    const showStatus = (message) => {
      if (!status) return;
      status.textContent = message;
      status.hidden = false;
    };

    const hideStatus = () => {
      if (status) status.hidden = true;
    };

    const getColorTheme = () => {
      const html = document.documentElement;
      return html.dataset.theme === "dark" || html.classList.contains("dark")
        ? "dark"
        : "light";
    };

    const normalizeClientToolArgs = (args) => {
      if (!args) return {};
      if (typeof args === "string") {
        try {
          return JSON.parse(args);
        } catch {
          return {};
        }
      }
      return args;
    };

    const analyticsViewport = () =>
      window.matchMedia("(min-width: 768px)").matches ? "desktop" : "mobile";

    const trackDocsAgentEvent = (name, data = {}) => {
      try {
        window.__docsAgentTrackEvent?.(name, {
          surface: "docs_agent",
          route: window.location.pathname || "/",
          viewport: analyticsViewport(),
          ...data,
        });
      } catch {
        // Ignore analytics failures.
      }
    };

    const navigationTarget = (href, options) =>
      window.__getDocsAgentNavigationTarget(
        href,
        window.location.href,
        options
      );

    const navigateToHref = async (href, { externalNewTab = false } = {}) => {
      const target = navigationTarget(href);
      if (!target.ok) return target;
      const routeHref = target.href;

      if (
        routeHref.startsWith("/") &&
        typeof window.__docsAgentNavigate === "function"
      ) {
        docsAgentNavigationInProgress = true;
        try {
          await withTimeout(
            window.__docsAgentNavigate(routeHref, { history: "push" }),
            docsAgentNavigationTimeoutMs,
            "Docs agent navigation timed out"
          );
        } catch (error) {
          console.error("Docs agent navigation failed", error);
          return { ok: false, error: "Navigation failed or timed out." };
        } finally {
          docsAgentNavigationInProgress = false;
        }
      } else if (externalNewTab) {
        window.open(routeHref, "_blank", "noopener,noreferrer");
      } else {
        window.location.assign(routeHref);
      }

      return { ok: true, href: routeHref };
    };

    const navigationQueue =
      window.__createDocsAgentNavigationQueue(navigateToHref);

    const queueNavigationToHref = (href, options) => {
      const target = navigationTarget(href, options);
      if (!target.ok) return target;
      navigationQueue.queue(target.href);
      return target;
    };

    const chatKitTurnSettledCallbacks = new Set();

    const chatKitTurnIsActive = () =>
      chatkitResponseActive ||
      chatkitTurnActive ||
      navigationQueue.hasPending();

    const notifyChatKitTurnSettled = () => {
      if (chatKitTurnIsActive()) return;
      for (const callback of chatKitTurnSettledCallbacks) {
        callback();
      }
      chatKitTurnSettledCallbacks.clear();
    };

    const waitForChatKitTurnToSettle = (signal) => {
      if (signal.aborted) return Promise.resolve("aborted");
      if (!chatKitTurnIsActive()) return Promise.resolve("settled");

      return new Promise((resolve) => {
        let timeout;
        const finish = (result) => {
          window.clearTimeout(timeout);
          signal.removeEventListener("abort", onAbort);
          chatKitTurnSettledCallbacks.delete(onSettled);
          resolve(result);
        };
        const onAbort = () => finish("aborted");
        const onSettled = () => finish("settled");

        signal.addEventListener("abort", onAbort, { once: true });
        chatKitTurnSettledCallbacks.add(onSettled);
        timeout = window.setTimeout(
          () => finish("timed-out"),
          docsAgentTransitionWaitTimeoutMs
        );
      });
    };

    const deferPageTransitionDuringChatKitTurn = (event) => {
      if (docsAgentNavigationInProgress || !chatKitTurnIsActive()) return;
      const loadPage = event.loader;
      event.loader = async () => {
        const result = await waitForChatKitTurnToSettle(event.signal);
        if (result === "aborted" || event.signal.aborted) return;
        if (result === "timed-out") {
          // Asking Astro to cancel here makes it fall back to a full load. That
          // is safer than moving a ChatKit frame whose turn did not terminate.
          event.preventDefault();
          return;
        }
        await loadPage();
      };
    };

    const bindChatKitLifecycle = () => {
      if (chatkit.dataset.docsAgentLifecycleBound === "true") return;
      chatkit.dataset.docsAgentLifecycleBound = "true";
      chatkit.addEventListener("chatkit.thread.change", (event) => {
        const threadId = event?.detail?.threadId;
        if (threadId === null) {
          conversationStartedTracked = false;
        }
      });
      chatkit.addEventListener("chatkit.response.start", () => {
        chatkitResponseActive = true;
        navigationQueue.onResponseStart();
      });
      chatkit.addEventListener("chatkit.response.end", () => {
        chatkitResponseActive = false;
        void navigationQueue
          .onResponseEnd()
          .then(() => {
            if (!navigationQueue.hasPending()) {
              chatkitTurnActive = false;
              notifyChatKitTurnSettled();
            }
          })
          .catch((error) => {
            console.error("Docs agent navigation failed", error);
          });
      });
      chatkit.addEventListener("chatkit.error", () => {
        chatkitResponseActive = false;
        chatkitTurnActive = false;
        navigationQueue.clear();
        notifyChatKitTurnSettled();
      });
    };

    const buildChatKitOptions = () => ({
      api: {
        url: apiURL,
        domainKey,
        fetch: docsAgentFetch,
      },
      theme: {
        colorScheme: getColorTheme(),
      },
      header: { enabled: false },
      onClientTool(toolCall) {
        const args = normalizeClientToolArgs(
          toolCall?.params || toolCall?.arguments
        );

        if (toolCall?.name === "navigate_to_page") {
          return queueNavigationToHref(args.href, { internalOnly: true });
        }

        if (toolCall?.name === "open_custom_guide") {
          const guideHref =
            args.href ||
            (args.generated_id ? `/custom-guide/${args.generated_id}` : "");
          trackDocsAgentEvent("docs_agent_custom_guide_opened", {
            source: "client_tool",
            guide_id: args.generated_id || "",
            href: guideHref,
          });
          return queueNavigationToHref(guideHref);
        }

        return {
          ok: false,
          error: `Unknown client tool: ${toolCall?.name || "unknown"}.`,
        };
      },
      widgets: {
        onAction(action) {
          const payload = normalizeClientToolArgs(action?.payload);

          if (action?.type === "custom_guide.view") {
            const guideHref =
              payload.href ||
              payload.url ||
              (payload.generated_id
                ? `/custom-guide/${payload.generated_id}`
                : "");
            trackDocsAgentEvent("docs_agent_custom_guide_opened", {
              source: "widget_action",
              guide_id: payload.generated_id || "",
              href: guideHref,
            });

            return navigateToHref(guideHref);
          }

          if (action?.type === "docs_agent.navigate") {
            const href = payload.href || payload.url || "";
            trackDocsAgentEvent("docs_agent_suggested_page_opened", {
              source: "widget_action",
              href,
              suggestion_title: payload.title || "",
              suggestion_type: payload.type || "",
            });

            return navigateToHref(href, { externalNewTab: true });
          }

          return {
            ok: false,
            error: `Unknown widget action: ${action?.type || "unknown"}.`,
          };
        },
      },
      composer: {
        placeholder: "Ask about docs or what you want to build",
      },
      startScreen: {
        greeting: startGreeting,
        prompts: startPromptsForRoute(desiredPathname),
      },
    });

    const applyChatKitOptions = () => {
      chatkit.setOptions(buildChatKitOptions());
    };

    // Existing ChatKit instances keep the options they were created with.
    // Route changes only select the prompts for the next explicit new thread.
    const syncDesiredPathnameForPageLoad = () => {
      desiredPathname = window.location.pathname || "/";
    };

    const syncDesiredPathnameBeforeSwap = (event) => {
      const destination = event?.to;
      if (destination instanceof URL) {
        desiredPathname = destination.pathname || "/";
      } else if (typeof destination === "string") {
        desiredPathname = new URL(destination, window.location.href).pathname;
      }
    };

    const initializeChatKit = async () => {
      if (chatkitInitialized) return;
      showStatus("Loading docs agent...");

      try {
        await withTimeout(
          customElements.whenDefined("openai-chatkit"),
          docsAgentInitializationTimeoutMs,
          "Docs agent initialization timed out"
        );

        bindChatKitLifecycle();
        applyChatKitOptions();
        chatkitInitialized = true;
        hideStatus();
      } catch (error) {
        console.error("Failed to initialize Docs Agent ChatKit", error);
        showStatus("Docs agent is unavailable.");
      }
    };

    const resetChatKit = () => {
      if (chatkitReplacement) return chatkitReplacement;
      navigationQueue.clear();

      chatkitReplacement = (async () => {
        const nextChatKit = document.createElement("openai-chatkit");
        nextChatKit.id = "docs-agent-chatkit";
        nextChatKit.className = "block h-full w-full";
        chatkit.replaceWith(nextChatKit);
        chatkit = nextChatKit;
        chatkitInitialized = false;
        chatkitResponseActive = false;
        chatkitTurnActive = false;
        conversationStartedTracked = false;
        resetDocsAgentSessionId();
        await initializeChatKit();
        notifyChatKitTurnSettled();
      })();

      void chatkitReplacement.then(
        () => {
          chatkitReplacement = null;
        },
        () => {
          chatkitReplacement = null;
        }
      );
      return chatkitReplacement;
    };

    const openPanel = () => {
      if (root.dataset.open !== "true") {
        trackDocsAgentEvent("docs_agent_panel_opened", {
          source: "ask_button",
          has_page_selection: hasPageSelectionForAnalytics(),
        });
      }
      previousFocus = document.activeElement;
      document.body.dataset.docsAgentOpen = "true";
      document.body.classList.add("docs-agent-open");
      root.dataset.open = "true";
      root.classList.add("is-open");
      syncLayoutTargets();
      initializeChatKit();
      requestAnimationFrame(() => closeButton.focus());
    };

    const closePanel = () => {
      delete document.body.dataset.docsAgentOpen;
      document.body.classList.remove("docs-agent-open");
      delete root.dataset.open;
      root.classList.remove("is-open");
      syncLayoutTargets();
      if (previousFocus instanceof HTMLElement) {
        previousFocus.focus();
      }
    };

    clearLegacyStoredState();
    desktopPanelMedia.addEventListener("change", syncLayoutTargets);
    document.addEventListener("selectionchange", rememberPageSelection);
    document.addEventListener(
      "astro:before-preparation",
      deferPageTransitionDuringChatKitTurn
    );
    document.addEventListener(
      "astro:before-swap",
      syncDesiredPathnameBeforeSwap
    );
    document.addEventListener("astro:page-load", syncLayoutTargets);
    document.addEventListener(
      "astro:page-load",
      syncDesiredPathnameForPageLoad
    );
    document.addEventListener("pointerdown", (event) => {
      if (
        event.target instanceof Element &&
        event.target.closest("button[data-docs-agent-open]")
      ) {
        rememberPageSelection();
      }
    });
    document.addEventListener("click", (event) => {
      if (
        event.target instanceof Element &&
        event.target.closest("button[data-docs-agent-open]")
      ) {
        openPanel();
      }
    });
    newButton.addEventListener("click", resetChatKit);
    closeButton.addEventListener("click", closePanel);
    window.addEventListener("docs-agent:close", closePanel);
    panel.addEventListener("keydown", (event) => {
      if (event.key === "Escape") {
        closePanel();
      }
    });

    root.dataset.initialized = "true";
    syncLayoutTargets();
  }

  document.addEventListener("astro:page-load", initializeDocsAgentLauncher);
  window.addEventListener(
    "docs-agent:helpers-ready",
    initializeDocsAgentLauncher
  );
  initializeDocsAgentLauncher();
</script> <script type="module" src="/_astro/PageLayout.astro_astro_type_script_index_0_lang.BWl5gtCl.js" data-astro-exec=""></script>  </body></html>