<!DOCTYPE html><html lang="en" class="inter_1d81deff-module__CYM0aG__variable papermono_89c757f2-module__6aS5zq__variable dark" data-banner-state="visible" data-assistant-state="closed" data-page-mode="none" data-current-path="/"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/><link rel="preload" href="/docs/_next/static/media/83afe278b6a6bb3c.p.3a6ba036.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/docs/_next/static/media/PaperMono_Variable.p.aa32f7a0.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/docs/_next/static/media/f67ad414ed34149c.p.84166d94.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" as="image" href="https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-light.svg?fit=max&amp;auto=format&amp;n=ksNSeB_K7gD-BUDh&amp;q=85&amp;s=690e45873843519efe02bcbe45795dac"/><link rel="preload" as="image" href="https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-dark.svg?fit=max&amp;auto=format&amp;n=ksNSeB_K7gD-BUDh&amp;q=85&amp;s=8ba2f49b11cd9839c37dd03c62537ebd"/><link rel="stylesheet" href="/docs/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" data-precedence="next"/><link rel="stylesheet" href="/docs/_next/static/chunks/130071cec1814339.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" data-precedence="next"/><style data-precedence="base-ui:low" data-href="base-ui-disable-scrollbar">.base-ui-disable-scrollbar{scrollbar-width:none}.base-ui-disable-scrollbar::-webkit-scrollbar{display:none}</style><link rel="preload" as="script" fetchPriority="low" href="/docs/_next/static/chunks/6d55b684068fd47e.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK"/><script src="/docs/_next/static/chunks/44795504c795ca32.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/8470141258a8cdc3.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/f486afc314643ce1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/6ab2b57d39308a6c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/turbopack-2e914d270b534a41.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/27af74e29bec69c2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/e168288d4907c254.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/6b1866b1722b1057.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><script src="/docs/_next/static/chunks/746594ec3bf27705.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" async=""></script><link rel="preload" href="https://www.googletagmanager.com/gtag/js?id=G-R8YZRJS2XN" as="script"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="preload" href="https://d4tuoctqmanu0.cloudfront.net/katex.min.css" as="style"/><title>Tool &amp; Function Calling - Use Tools with OpenRouter</title><meta name="description" content="Use tools in your prompts"/><meta name="application-name" content="OpenRouter | Documentation"/><meta name="generator" content="Mintlify"/><meta name="msapplication-config" content="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/browserconfig.xml"/><meta name="apple-mobile-web-app-title" content="OpenRouter | Documentation"/><meta name="msapplication-TileColor" content="#7624F4"/><link rel="canonical" href="https://openrouter.ai/docs/guides/features/tool-calling"/><link rel="alternate" type="application/xml" href="/docs/sitemap.xml"/><link rel="alternate" type="text/markdown" href="/docs/guides/features/tool-calling.md"/><meta property="og:title" content="Tool &amp; Function Calling - Use Tools with OpenRouter"/><meta property="og:description" content="Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling."/><meta property="og:url" content="https://openrouter.ai/docs/guides/features/tool-calling"/><meta property="og:site_name" content="OpenRouter Documentation"/><meta property="og:image" content="https://openrouter.ai/dynamic-og?title=Tool%20&amp;%20Function%20Calling&amp;description=Use%20tools%20with%20OpenRouter"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Tool &amp; Function Calling - Use Tools with OpenRouter"/><meta name="twitter:description" content="Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling."/><meta name="twitter:image" content="https://openrouter.ai/dynamic-og?title=Tool%20&amp;%20Function%20Calling&amp;description=Use%20tools%20with%20OpenRouter"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/android-chrome-192x192.png" type="image/png" sizes="192x192" media="(prefers-color-scheme: light)"/><link rel="apple-touch-icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/apple-touch-icon.png" type="image/png" sizes="180x180"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon-16x16.png" type="image/png" sizes="16x16" media="(prefers-color-scheme: light)"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon-32x32.png" type="image/png" sizes="32x32" media="(prefers-color-scheme: light)"/><link rel="shortcut icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon.ico" type="image/x-icon" media="(prefers-color-scheme: light)"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/android-chrome-192x192.png" type="image/png" sizes="192x192" media="(prefers-color-scheme: dark)"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon-16x16.png" type="image/png" sizes="16x16" media="(prefers-color-scheme: dark)"/><link rel="icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon-32x32.png" type="image/png" sizes="32x32" media="(prefers-color-scheme: dark)"/><link rel="shortcut icon" href="/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon.ico" type="image/x-icon" media="(prefers-color-scheme: dark)"/><script type="text/javascript">!function(){var b="/docs";
function a(p){if(p==null)return"/";p=""+p;if(""===p)return"/";return"/"===p.charAt(0)?p:"/"+p}
function u(p){if(p==null)return p;p=""+p;if(!p||p.charAt(p.length-1)==="/")return p.slice(0,-1);return p}
function i(p){if(p==null)return p;p=""+p;if(6<=p.length&&p.substring(p.length-6)==="/index")return p.substring(0,p.length-6);if("index"===p)return"";return p}
var p=(location.pathname||"").split("?")[0].split("#")[0]||"";
if(b)if(p===b)p="";else if(0===p.indexOf(b+"/"))p=p.substring(b.length);
p=a(p);p=u(p);p=i(p);p=""===p||"index"===p?"/":a(p);
document.documentElement.setAttribute("data-current-path",p);
}();</script><script type="text/javascript">!function(){
function read(){try{
var e=performance.getEntriesByType?performance.getEntriesByType("navigation"):[];
var st=(e[0]&&e[0].serverTiming)||[];
var g={};
for(var i=0;i<st.length;i++){var n=st[i].name,d=st[i].description;if(!d)continue;try{d=decodeURIComponent(d)}catch(x){}
if(n==="country")g.country=d;else if(n==="region")g.region=d;else if(n==="continent")g.continent=d;}
var w=window;w.mintlify=w.mintlify||{};w.mintlify.geo=g;
}catch(x){}}
read();document.addEventListener("DOMContentLoaded",read);
}();</script><script type="text/javascript">!function(){try{
var w=window;w.mintlify=w.mintlify||{};
var q=w.mintlify.__apiPlaygroundInputsQueue;
if(!Array.isArray(q)){q=[];w.mintlify.__apiPlaygroundInputsQueue=q;}
w.mintlify.api=w.mintlify.api||{};
w.mintlify.api.playground=w.mintlify.api.playground||{};
if(typeof w.mintlify.api.playground.setServerVariables!=="function"){
w.mintlify.api.playground.setServerVariables=function(v){q.push({type:"set",variables:v});};
}
if(typeof w.mintlify.api.playground.clearServerVariables!=="function"){
w.mintlify.api.playground.clearServerVariables=function(){q.push({type:"clear"});};
}
}catch(e){}}();</script><script type="text/javascript">(function(a,b){try{let c=document.getElementById("banner")?.innerText;if(c){for(let d=0;d<localStorage.length;d++){let e=localStorage.key(d);if(e?.endsWith(a)&&localStorage.getItem(e)===c)return void document.documentElement.setAttribute(b,"hidden")}document.documentElement.setAttribute(b,"visible");return}for(let c=0;c<localStorage.length;c++){let d=localStorage.key(c);if(d?.endsWith(a)&&localStorage.getItem(d))return void document.documentElement.setAttribute(b,"hidden")}document.documentElement.setAttribute(b,"visible")}catch(a){document.documentElement.setAttribute(b,"hidden")}})(
  "bannerDismissed",
  "data-banner-state",
)</script><script src="/docs/_next/static/chunks/a6dad97d9634a72d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" noModule=""></script></head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","isDarkMode","dark",null,["dark","light","true","false","system"],{"true":"dark","false":"light","dark":"dark","light":"light"},true,false)</script><script>(function(){try{var f=null;var v=f||localStorage.getItem("isDarkMode");if(v==='true')v='dark';else if(v==='false')v='light';if(v!=='light'&&v!=='dark'&&v!=='system')v="dark";document.documentElement.setAttribute("data-theme-preference",v)}catch(e){}})();</script><blockquote class="sr-only" data-agent-docs-index="true" aria-hidden="true"><h2>Documentation Index</h2><p>Fetch the complete documentation index at:<!-- --> <a href="/docs/llms.txt" tabindex="-1">/docs/llms.txt</a></p><p>Use this file to discover all available pages before exploring further.</p></blockquote><style>:root{--banner-height:0px!important}</style><script>(self.__next_s=self.__next_s||[]).push([0,{"children":"(function j(a,b,c,d,e){try{let f,g,h=[];try{h=window.location.pathname.split(\"/\").filter(a=\u003e\"\"!==a\u0026\u0026\"global\"!==a).slice(0,2)}catch{h=[]}let i=h.find(a=\u003ec.includes(a)),j=[];for(let c of(i?j.push(i):j.push(b),j.push(\"global\"),j)){if(!c)continue;let b=a[c];if(b?.content){f=b.content,g=c;break}}if(!f)return void document.documentElement.setAttribute(d,\"hidden\");let k=!0,l=0;for(;l\u003clocalStorage.length;){let a=localStorage.key(l);if(l++,!a?.endsWith(e))continue;let b=localStorage.getItem(a);if(b\u0026\u0026b===f){k=!1;break}g\u0026\u0026(a.startsWith(`lang:${g}_`)||!a.startsWith(\"lang:\"))\u0026\u0026(localStorage.removeItem(a),l--)}document.documentElement.setAttribute(d,k?\"visible\":\"hidden\")}catch(a){console.error(a),document.documentElement.setAttribute(d,\"hidden\")}})(\n  {},\n  \"en\",\n  [],\n  \"data-banner-state\",\n  \"bannerDismissed\",\n)","id":"_mintlify-banner-script"}])</script><link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;1,400&amp;display=swap" rel="stylesheet"/><link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;1,400&amp;display=swap" rel="stylesheet"/><style>:root {
  --font-family-headings-custom: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-weight-headings-custom: 400;
  --font-family-body-custom: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-weight-body-custom: 400;
  
}
</style><style>:root {
    --primary: 118 36 244;
    --primary-light: 118 36 244;
    --primary-dark: 200 255 0;
    --tooltip-foreground: 0 0 0;
    --background-light: 252 252 254;
    --background-dark: 3 8 10;
    --gray-50: 246 243 250;
    --gray-100: 241 239 245;
    --gray-200: 226 223 229;
    --gray-300: 209 207 213;
    --gray-400: 162 159 165;
    --gray-500: 115 113 119;
    --gray-600: 83 81 87;
    --gray-700: 66 63 70;
    --gray-800: 40 38 44;
    --gray-900: 26 23 30;
    --gray-950: 13 11 17;
  }</style><script type="text/javascript">
          (function() {
            function loadKatex() {
              const link = document.querySelector('link[href="https://d4tuoctqmanu0.cloudfront.net/katex.min.css"]');
              if (link) link.rel = 'stylesheet';
            }
            if (document.readyState === 'loading') {
              document.addEventListener('DOMContentLoaded', loadKatex);
            } else {
              loadKatex();
            }
          })();
        </script><div class="relative antialiased text-gray-500 dark:text-gray-400 [[&amp;_:is(h1,h2,h3,h4,h5,h6)]:font-headingsWeight [&amp;_*:not(h1,h2,h3,h4,h5,h6,h1_*,h2_*,h3_*,h4_*,h5_*,h6_*)]:font-bodyWeight"><script>(self.__next_s=self.__next_s||[]).push([0,{"suppressHydrationWarning":true,"children":"(function(a){let b,c=(b=\"navbar-transition\",\"maple\"===a\u0026\u0026(b+=\"-maple\"),b),d=function(){let a=document.createElement(\"style\");return a.appendChild(document.createTextNode(\"*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}\")),document.head.appendChild(a),function(){window.getComputedStyle(document.body),setTimeout(()=\u003e{document.head.removeChild(a)},1)}}();(\"requestAnimationFrame\"in globalThis?requestAnimationFrame:setTimeout)(()=\u003e{let a;a=!1,a=window.scrollY\u003e50,document.getElementById(c)?.setAttribute(\"data-is-opaque\",`${!!a}`),d()})})(\"mint\")","id":"_mintlify-navbar-transition-script"}])</script><script>(self.__next_s=self.__next_s||[]).push([0,{"suppressHydrationWarning":true,"children":"(function () {\n  var measure = function(){let a=document.querySelectorAll(\"[id='navbar'], [data-top-chrome]\"),b=0;a.forEach(a=\u003e{let c=a.getBoundingClientRect();c.height\u003e0\u0026\u0026(b=Math.max(b,c.bottom))});let c=0,d=document.getElementById(\"content-container\");if(d){let{overflowY:a}=getComputedStyle(d);(\"auto\"===a||\"scroll\"===a)\u0026\u0026(c=Math.max(0,d.getBoundingClientRect().top))}let e=`${Math.round(Math.max(0,b-c))+40}px`,f=document.documentElement.style;f.getPropertyValue(\"--scroll-mt\")!==e\u0026\u0026f.setProperty(\"--scroll-mt\",e)};\n  (function(a){let b=[],c=0,d=\"undefined\"==typeof ResizeObserver?null:new ResizeObserver(f);function e(){let c=Array.from(document.querySelectorAll(\"[id='navbar'], [data-top-chrome]\"));(c.length!==b.length||c.some((a,c)=\u003ea!==b[c]))\u0026\u0026d\u0026\u0026(d.disconnect(),c.forEach(a=\u003ed.observe(a))),b=c,a()}function f(){c||(c=requestAnimationFrame(()=\u003e{c=0,e()}))}let g=\"[id='navbar'], [data-top-chrome]\";function h(a){let b=a.target;if(b instanceof Element\u0026\u0026b.closest(g))return!0;for(let b of a.addedNodes)if(b instanceof Element\u0026\u0026(b.matches(g)||b.querySelector(g)))return!0;for(let b of a.removedNodes)if(b instanceof Element\u0026\u0026(b.matches(g)||b.querySelector(g)))return!0;return!1}new MutationObserver(a=\u003e{a.some(h)\u0026\u0026f()}).observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener(\"resize\",f),\"loading\"===document.readyState\u0026\u0026document.addEventListener(\"DOMContentLoaded\",e),e()})(measure);\n  (function(a){let b=window.location.hash.slice(1);if(!b)return;function c(){return\"smooth\"===getComputedStyle(document.documentElement).scrollBehavior}function d(c){let d=document.getElementById(b);return!!d\u0026\u0026(a(),d.scrollIntoView(c?{behavior:c}:void 0),!0)}if(\"complete\"===document.readyState)return void d();let e=new MutationObserver(()=\u003e{!c()\u0026\u0026d(\"instant\")\u0026\u0026f()});function f(){e.disconnect(),window.removeEventListener(\"load\",g)}function g(){let a=c();f(),a\u0026\u0026requestAnimationFrame(()=\u003e{d(),function(){let a=[\"wheel\",\"touchstart\",\"keydown\",\"pointerdown\"],c=0,e=window.scrollY,f=setInterval(()=\u003e{c+=1;let a=document.getElementById(b);if(!a||c\u003e=6)return g();let f=Math.abs(window.scrollY-e)\u003e1;if(e=window.scrollY,f)return;let h=parseFloat(getComputedStyle(a).scrollMarginTop)||0;Math.abs(a.getBoundingClientRect().top-h)\u003e4\u0026\u0026d()},350);function g(){clearInterval(f),a.forEach(a=\u003ewindow.removeEventListener(a,g))}a.forEach(a=\u003ewindow.addEventListener(a,g,{passive:!0}))}()})}window.addEventListener(\"load\",g),e.observe(document.documentElement,{childList:!0,subtree:!0}),!c()\u0026\u0026d(\"instant\")\u0026\u0026f()})(measure);\n})();","id":"_mintlify-scroll-margin-script"}])</script><a href="#content-area" class="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:p-2 focus:text-sm focus:bg-background-light dark:focus:bg-background-dark focus:rounded-md focus:outline-primary dark:focus:outline-primary-light">Skip to main content</a><script>(function i(a,b,c,d){try{if(window.matchMedia("(max-width: 1024px)").matches||!d){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed"),d||localStorage.setItem(a,"false");return}let e=localStorage.getItem(a);if(null===e){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed");return}let f=JSON.parse(e),g=localStorage.getItem(b),h=null!==g?JSON.parse(g):368;document.documentElement.style.setProperty(c,f?h+"px":"0px"),document.documentElement.setAttribute("data-assistant-state",f?"open":"closed")}catch(a){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed")}})(
    "chat-assistant-sheet-open",
    "chat-assistant-sheet-width",
    "--assistant-sheet-width",
    true
  )</script><div class="max-lg:contents lg:flex lg:w-full" data-docs-theme="mint"><div class="max-lg:contents lg:flex-1 lg:min-w-0 lg:overflow-x-clip"><header id="navbar" class="z-30 fixed lg:sticky top-0 w-full peer is-not-custom peer is-not-center peer is-not-wide peer is-not-frame"><div id="navbar-transition" class="absolute w-full h-full flex-none transition-colors duration-500 border-b border-gray-500/5 dark:border-gray-300/[0.06] bg-background-light dark:bg-background-dark" data-is-opaque="false"></div><div class="max-w-8xl mx-auto relative"><div><div class="relative"><div class="flex items-center lg:px-12 h-16 min-w-0 mx-4 lg:mx-0"><div class="h-full relative flex-1 flex items-center gap-x-4 min-w-0 border-b border-gray-500/5 dark:border-gray-300/[0.06]"><div class="flex-1 flex items-center gap-x-4"><a class="select-none" style="-webkit-touch-callout:none" href="https://openrouter.ai"><span class="sr-only">OpenRouter | Documentation<!-- --> home page</span><img class="nav-logo w-auto h-7 relative object-contain shrink-0 block dark:hidden" src="https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-light.svg?fit=max&amp;auto=format&amp;n=ksNSeB_K7gD-BUDh&amp;q=85&amp;s=690e45873843519efe02bcbe45795dac" alt="light logo"/><img class="nav-logo w-auto h-7 relative object-contain shrink-0 hidden dark:block" src="https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-dark.svg?fit=max&amp;auto=format&amp;n=ksNSeB_K7gD-BUDh&amp;q=85&amp;s=8ba2f49b11cd9839c37dd03c62537ebd" alt="dark logo"/></a><div class="hidden lg:flex items-center gap-x-2"></div></div><div class="relative hidden lg:flex items-center flex-1 z-20 gap-2.5"><button type="button" class="group/search flex pointer-events-auto rounded-xl w-full items-center text-sm leading-6 h-9 pl-3.5 pr-3 text-gray-500 dark:text-white/50 bg-background-light dark:bg-background-dark dark:brightness-[1.1] dark:ring-1 dark:hover:brightness-[1.25] ring-1 ring-gray-400/30 hover:ring-gray-600/30 dark:ring-gray-600/30 dark:hover:ring-gray-500/30 justify-between truncate gap-2" id="search-bar-entry" aria-label="Open search"><div class="flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-4 min-w-4 flex-none text-gray-700 group-hover/search:text-gray-800 dark:text-gray-400 dark:group-hover/search:text-gray-200"><path d="M15.25 15.25L11.285 11.285" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M7.75 12.75C10.5114 12.75 12.75 10.5114 12.75 7.75C12.75 4.98858 10.5114 2.75 7.75 2.75C4.98858 2.75 2.75 4.98858 2.75 7.75C2.75 10.5114 4.98858 12.75 7.75 12.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><div class="truncate min-w-0">Search...</div></div><span class="flex-none text-xs font-semibold">⌘<!-- -->K</span></button><button type="button" class="group/ai flex-none hidden lg:flex items-center justify-center gap-1.5 pl-3 pr-3.5 h-9 rounded-xl bg-background-light dark:bg-background-dark dark:brightness-[1.1] dark:ring-1 dark:hover:brightness-[1.25] ring-1 ring-gray-400/30 hover:ring-gray-600/30 dark:ring-gray-600/30 dark:hover:ring-gray-500/30" id="assistant-entry" aria-label="Toggle assistant panel" data-base-ui-tooltip-trigger=""><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-4 shrink-0 text-gray-700 group-hover/ai:text-gray-800 dark:text-gray-400 dark:group-hover/ai:text-gray-200"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><span class="text-sm text-gray-500 dark:text-white/50 whitespace-nowrap">Ask Assistant</span></button></div><div class="flex-1 relative hidden lg:flex items-center ml-auto justify-end space-x-4"><nav aria-label="Main" class="text-sm"><ul class="flex space-x-6 items-center"><li class="navbar-link"><a href="https://openrouter.ai/models" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Models</span></a></li><li class="navbar-link"><a href="https://openrouter.ai/benchmarks" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Benchmarks</span></a></li><li class="navbar-link"><a href="https://openrouter.ai/chat" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Chat</span></a></li><li class="navbar-link"><a href="https://openrouter.ai/rankings" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Rankings</span></a></li><li class="navbar-link"><a href="https://openrouter.ai/apps" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Apps</span></a></li><li class="navbar-link"><a href="https://openrouter.ai/docs" class="flex items-center gap-1.5 whitespace-nowrap font-medium text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" target="_blank" rel="noopener noreferrer"><span class="min-w-0 truncate">Docs</span></a></li></ul></nav><div class="flex items-center"><button type="button" tabindex="0" aria-haspopup="menu" id="theme-preference-menu-trigger" aria-label="Change theme preference" data-component-name="theme-preference-menu" data-component-part="theme-preference-menu-trigger" data-testid="theme-preference-menu-trigger" class="group disabled:pointer-events-none rounded-lg overflow-hidden gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 theme-preference-menu-trigger group p-2 flex items-center justify-center"><span data-theme-preference-icon="system"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-gray-500 dark:text-gray-400 group-hover:text-gray-700 dark:group-hover:text-gray-200"><path d="M4.5 15.5L9 14.5L13.5 15.5" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.75V14.5" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.25 2.75H3.75C2.64543 2.75 1.75 3.64543 1.75 4.75V9.75C1.75 10.8546 2.64543 11.75 3.75 11.75H14.25C15.3546 11.75 16.25 10.8546 16.25 9.75V4.75C16.25 3.64543 15.3546 2.75 14.25 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></span><span data-theme-preference-icon="light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-gray-500 dark:text-gray-400 group-hover:text-gray-700 dark:group-hover:text-gray-200"><path d="M9 1.25V2.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.48 3.52002L13.773 4.22702" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M16.75 9H15.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.48 14.4799L13.773 13.7729" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 16.75V15.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.52 14.4799L4.227 13.7729" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M1.25 9H2.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.52 3.52002L4.227 4.22702" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 13.25C11.3472 13.25 13.25 11.3472 13.25 9C13.25 6.65279 11.3472 4.75 9 4.75C6.65279 4.75 4.75 6.65279 4.75 9C4.75 11.3472 6.65279 13.25 9 13.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></span><span data-theme-preference-icon="dark"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-gray-500 dark:text-gray-400 group-hover:text-gray-700 dark:group-hover:text-gray-200"><path d="M13 11.75C9.548 11.75 6.75 8.95201 6.75 5.50001C6.75 4.14801 7.183 2.90101 7.912 1.87801C4.548 2.50601 2 5.45301 2 9.00001C2 13.004 5.246 16.25 9.25 16.25C12.622 16.25 15.448 13.944 16.259 10.826C15.309 11.409 14.196 11.75 13 11.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></span></button></div></div><div class="flex lg:hidden items-center gap-3"><button type="button" class="text-gray-500 w-8 h-8 flex items-center justify-center hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300" id="search-bar-entry-mobile" aria-label="Open search"><span class="sr-only">Search...</span><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-gray-500 dark:bg-gray-400 hover:bg-gray-600 dark:hover:bg-gray-300" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/solid/magnifying-glass.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/solid/magnifying-glass.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></button><button id="assistant-entry-mobile" aria-label="Toggle assistant panel"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-4.5 text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><button type="button" aria-label="More actions" class="h-7 w-5 flex items-center justify-center relative after:content-[&#x27;&#x27;] after:absolute after:-inset-y-2 after:-left-1 after:-right-4"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 shrink-0 bg-gray-500 dark:bg-gray-400 hover:bg-gray-600 dark:hover:bg-gray-300" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/solid/ellipsis-vertical.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/solid/ellipsis-vertical.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></button></div></div></div><button type="button" class="flex items-center h-14 py-4 px-5 lg:hidden focus:outline-0 w-full text-left"><div class="text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300"><span class="sr-only">Navigation</span><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0"><path d="M2.25 9H15.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.25 3.75H15.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.25 14.25H15.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div><div class="ml-4 flex text-sm leading-6 whitespace-nowrap min-w-0 space-x-3 overflow-hidden"><div class="flex items-center space-x-3 shrink-0"><span>Features</span><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 text-gray-400 shrink-0"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div><div class="font-semibold text-gray-900 truncate dark:text-gray-200 min-w-0 flex-1">Tool &amp; Function Calling</div></div></button></div><div class="hidden lg:flex px-12 h-12"><div class="nav-tabs h-full flex text-sm gap-x-6"><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium hover:text-gray-800 dark:hover:text-gray-300 text-gray-800 dark:text-gray-200 [text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor]" data-active="true" aria-current="location" href="/docs/quickstart"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg>Docs<div class="absolute bottom-0 h-[1.5px] w-full left-0 bg-primary dark:bg-primary-light"></div></a><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300" href="/docs/api_reference/overview"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/code.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/code.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg>API Reference<div class="absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"></div></a><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300" href="/docs/client-sdks/overview"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg>Client SDKs<div class="absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"></div></a><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300" href="/docs/agent-sdk/overview"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg>Agent SDK<div class="absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"></div></a><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300" href="/docs/cookbook/get-started/quickstart"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! h-4 w-4 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book-open.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book-open.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg>Cookbook<div class="absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"></div></a></div></div><style>:root{--topbar-tabs-height:3rem}</style></div></div></header><div class="scroll-mt-(--scroll-mt) peer-[.is-custom]:max-w-none peer-[.is-center]:max-w-3xl peer-[.is-not-custom]:peer-[.is-not-center]:max-w-8xl peer-[.is-not-custom]:px-4 peer-[.is-not-custom]:mx-auto peer-[.is-not-custom]:lg:px-8 peer-[.is-wide]:lg:*:last:max-w-216 peer-[.is-not-custom]:peer-[.is-not-center]:lg:flex peer-[.is-custom]:[&amp;&gt;:first-child]:hidden! peer-[.is-custom]:[&amp;&gt;:first-child]:sm:hidden! peer-[.is-custom]:[&amp;&gt;:first-child]:md:hidden! peer-[.is-custom]:[&amp;&gt;:first-child]:lg:hidden! peer-[.is-custom]:[&amp;&gt;:first-child]:xl:hidden! peer-[.is-center]:[&amp;&gt;:first-child]:hidden! peer-[.is-center]:[&amp;&gt;:first-child]:sm:hidden! peer-[.is-center]:[&amp;&gt;:first-child]:md:hidden! peer-[.is-center]:[&amp;&gt;:first-child]:lg:hidden! peer-[.is-center]:[&amp;&gt;:first-child]:xl:hidden!"><nav aria-label="Pages" class="z-20 hidden lg:block sticky self-start shrink-0 w-[18rem] top-(--mintlify-slot-header-height,calc(4rem+var(--topbar-tabs-height,0rem))) h-[calc(100dvh-var(--mintlify-slot-header-height,calc(4rem+var(--topbar-tabs-height,0rem))))]" id="sidebar"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" id="sidebar-content" class="min-w-0 absolute! inset-0 z-10"><div role="presentation" data-id="base-ui-_R_2tbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] pr-8 pb-10 base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-0! w-full"><div class="relative lg:text-sm lg:leading-6"><div class="sticky top-0 h-8 pointer-events-none z-10 bg-linear-to-b from-background-light dark:from-background-dark"></div><div id="navigation-items"><div><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/compass.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/compass.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Overview</span></h3></div><ul class="sidebar-group space-y-px"><li id="/quickstart" class="relative scroll-m-4 first:scroll-m-20" data-title="Quickstart"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/quickstart"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/rocket.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/rocket.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Quickstart</span></div></div></a></li><li id="/batch-quickstart" class="relative scroll-m-4 first:scroll-m-20" data-title="Batch"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/batch-quickstart"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/boxes-stacked.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/boxes-stacked.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Batch</span><div class="h-[1lh] flex items-center shrink-0 leading-[inherit]"><span class="nav-tag-pill flex items-center w-fit"><span class="nav-tag-pill-text px-1 py-0.5 rounded-md text-[0.65rem] leading-tight font-bold text-primary dark:text-primary-light bg-primary/10" data-nav-tag="Beta">Beta</span></span></div></div></div></a></li><li id="/guides/overview/principles" class="relative scroll-m-4 first:scroll-m-20" data-title="Principles"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/overview/principles"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/book.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Principles</span></div></div></a></li><li id="/guides/overview/models" class="relative scroll-m-4 first:scroll-m-20" data-title="Models"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/overview/models"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cube.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Models</span></div></div></a></li><li id="/guides/overview/mcp-server" class="relative scroll-m-4 first:scroll-m-20" data-title="MCP"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/overview/mcp-server"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">MCP</span></div></div></a></li><li data-title="Multimodal" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/layer-group.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/layer-group.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Multimodal</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li data-title="Authentication" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-check.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-check.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Authentication</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li id="/guides/overview/stripe-projects" class="relative scroll-m-4 first:scroll-m-20" data-title="Stripe Projects"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/overview/stripe-projects"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/stripe.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/stripe.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Stripe Projects</span></div></div></a></li><li id="/faq" class="relative scroll-m-4 first:scroll-m-20" data-title="FAQ"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/faq"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/question.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/question.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">FAQ</span></div></div></a></li><li id="/guides/overview/report-feedback" class="relative scroll-m-4 first:scroll-m-20" data-title="Report Feedback"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/overview/report-feedback"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/bug.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/bug.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Report Feedback</span></div></div></a></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/route.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/route.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Models &amp; Routing</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/routing/model-fallbacks" class="relative scroll-m-4 first:scroll-m-20" data-title="Model Fallbacks"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/routing/model-fallbacks"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/arrows-rotate.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/arrows-rotate.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Model Fallbacks</span></div></div></a></li><li id="/guides/routing/provider-selection" class="relative scroll-m-4 first:scroll-m-20" data-title="Provider Selection"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/routing/provider-selection"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/network-wired.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/network-wired.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Provider Selection</span></div></div></a></li><li id="/guides/routing/auto-exacto" class="relative scroll-m-4 first:scroll-m-20" data-title="Auto Exacto"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/routing/auto-exacto"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/crosshairs.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/crosshairs.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Auto Exacto</span></div></div></a></li><li id="/guides/routing/private-models" class="relative scroll-m-4 first:scroll-m-20" data-title="Private Models"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/routing/private-models"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lock.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lock.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Private Models</span></div></div></a></li><li data-title="Model Variants" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/gem.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/gem.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Model Variants</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li data-title="Routers" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/robot.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/robot.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Routers</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/stars.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/stars.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Features</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/features/workspaces" class="relative scroll-m-4 first:scroll-m-20" data-title="Workspaces"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/workspaces"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/grid-2.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/grid-2.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Workspaces</span></div></div></a></li><li id="/guides/features/workspaces/workspace-budgets" class="relative scroll-m-4 first:scroll-m-20" data-title="Workspace Budgets"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/workspaces/workspace-budgets"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/wallet.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/wallet.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Workspace Budgets</span></div></div></a></li><li id="/guides/features/workspaces/switching" class="relative scroll-m-4 first:scroll-m-20" data-title="Switching Workspaces"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/workspaces/switching"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/repeat.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/repeat.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Switching Workspaces</span></div></div></a></li><li id="/guides/features/sso" class="relative scroll-m-4 first:scroll-m-20" data-title="Single Sign-On (SSO)"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/sso"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-halved.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-halved.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Single Sign-On (SSO)</span></div></div></a></li><li id="/guides/features/scim-mappings" class="relative scroll-m-4 first:scroll-m-20" data-title="SCIM Group Mappings"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/scim-mappings"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/users-gear.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/users-gear.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">SCIM Group Mappings</span></div></div></a></li><li id="/guides/features/presets" class="relative scroll-m-4 first:scroll-m-20" data-title="Presets"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/presets"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/sliders.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/sliders.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Presets</span></div></div></a></li><li id="/guides/features/classifiers" class="relative scroll-m-4 first:scroll-m-20" data-title="Custom Classifiers"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/classifiers"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/tag.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/tag.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Custom Classifiers</span></div></div></a></li><li id="/guides/features/response-caching" class="relative scroll-m-4 first:scroll-m-20" data-title="Response Caching"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/response-caching"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/box-archive.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/box-archive.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Response Caching</span></div></div></a></li><li id="/guides/features/tool-calling" class="relative scroll-m-4 first:scroll-m-20" data-title="Tool Calling" data-active="true" data-active-nav-item="true"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] bg-primary/10 text-primary [text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor] dark:text-primary-light dark:bg-primary-light/10" style="padding-left:1rem" aria-current="page" href="/docs/guides/features/tool-calling"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-primary dark:bg-primary-light" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/toolbox.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/toolbox.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Tool Calling</span></div></div></a></li><li data-title="Server Tools" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/server.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/server.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Server Tools</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li data-title="Plugins" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Plugins</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li id="/guides/features/structured-outputs" class="relative scroll-m-4 first:scroll-m-20" data-title="Structured Outputs"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/structured-outputs"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/code.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/code.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Structured Outputs</span></div></div></a></li><li id="/guides/features/message-transforms" class="relative scroll-m-4 first:scroll-m-20" data-title="Message Transforms"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/message-transforms"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/arrows-rotate.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/arrows-rotate.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Message Transforms</span></div></div></a></li><li id="/guides/features/zero-completion-insurance" class="relative scroll-m-4 first:scroll-m-20" data-title="Zero Completion Insurance"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/zero-completion-insurance"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Zero Completion Insurance</span></div></div></a></li><li id="/guides/features/zdr" class="relative scroll-m-4 first:scroll-m-20" data-title="ZDR"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/zdr"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-halved.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-halved.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">ZDR</span></div></div></a></li><li id="/app-attribution" class="relative scroll-m-4 first:scroll-m-20" data-title="App Attribution"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/app-attribution"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/chart-line.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/chart-line.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">App Attribution</span></div></div></a></li><li data-title="Guardrails" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-check.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield-check.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Guardrails</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li><li id="/guides/features/service-tiers" class="relative scroll-m-4 first:scroll-m-20" data-title="Service Tiers"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/service-tiers"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/layer-group.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/layer-group.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Service Tiers</span></div></div></a></li><li id="/guides/features/sovereign-ai" class="relative scroll-m-4 first:scroll-m-20" data-title="Sovereign AI"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/sovereign-ai"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/globe.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/globe.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Sovereign AI</span></div></div></a></li><li id="/guides/features/router-metadata" class="relative scroll-m-4 first:scroll-m-20" data-title="Router Metadata"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/router-metadata"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/circle-info.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/circle-info.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Router Metadata</span></div></div></a></li><li id="/guides/features/input-output-logging" class="relative scroll-m-4 first:scroll-m-20" data-title="Input &amp; Output Logging"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/features/input-output-logging"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/file-lines.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/file-lines.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Input &amp; Output Logging</span></div></div></a></li><li data-title="Broadcast" data-group-tag="" class="space-y-px"><button class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" aria-expanded="false"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/broadcast-tower.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/broadcast-tower.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Broadcast</span></div><div class="h-[1lh] flex items-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 w-2 h-[1lh] -mr-0.5"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></button></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/terminal.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/terminal.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Ori</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/ori/eval" class="relative scroll-m-4 first:scroll-m-20" data-title="Ori Eval"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/ori/eval"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/vial-circle-check.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/vial-circle-check.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Ori Eval</span></div></div></a></li><li id="/guides/ori/harness" class="relative scroll-m-4 first:scroll-m-20" data-title="Ori Harness"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/ori/harness"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/plug.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Ori Harness</span></div></div></a></li><li id="/guides/ori/files" class="relative scroll-m-4 first:scroll-m-20" data-title="Where Ori writes files"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/ori/files"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/folder.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/folder.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Where Ori writes files</span></div></div></a></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/shield.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Privacy</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/privacy/data-collection" class="relative scroll-m-4 first:scroll-m-20" data-title="Data Collection"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/privacy/data-collection"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/database.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/database.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Data Collection</span></div></div></a></li><li id="/guides/privacy/provider-logging" class="relative scroll-m-4 first:scroll-m-20" data-title="Provider Logging"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/privacy/provider-logging"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/file-lines.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/file-lines.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Provider Logging</span></div></div></a></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lightbulb.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lightbulb.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Best Practices</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/best-practices/latency-and-performance" class="relative scroll-m-4 first:scroll-m-20" data-title="Latency and Performance"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/best-practices/latency-and-performance"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/gauge-high.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/gauge-high.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Latency and Performance</span></div></div></a></li><li id="/guides/best-practices/prompt-caching" class="relative scroll-m-4 first:scroll-m-20" data-title="Prompt Caching"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/best-practices/prompt-caching"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/database.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/database.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Prompt Caching</span></div></div></a></li><li id="/guides/best-practices/uptime-optimization" class="relative scroll-m-4 first:scroll-m-20" data-title="Uptime Optimization"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/best-practices/uptime-optimization"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/chart-line.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/chart-line.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Uptime Optimization</span></div></div></a></li><li id="/guides/best-practices/reasoning-tokens" class="relative scroll-m-4 first:scroll-m-20" data-title="Reasoning Tokens"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/best-practices/reasoning-tokens"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lightbulb.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/lightbulb.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Reasoning Tokens</span></div></div></a></li></ul></div><div class="mt-6 lg:mt-8"><div class="sidebar-group-header flex items-center gap-2.5 pl-4 mb-3.5 lg:mb-2.5 font-semibold text-gray-900 dark:text-gray-200"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! sidebar-group-icon h-3.5 w-3.5 bg-current" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/users.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/users.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Community</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/community/for-providers" class="relative scroll-m-4 first:scroll-m-20" data-title="For Providers"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/for-providers"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cloud.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/cloud.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">For Providers</span></div></div></a></li><li id="/guides/community/frameworks-and-integrations-overview" class="relative scroll-m-4 first:scroll-m-20" data-title="Frameworks and Integrations Overview"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/frameworks-and-integrations-overview"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Frameworks and Integrations Overview</span></div></div></a></li><li id="/guides/community/awesome-openrouter" class="relative scroll-m-4 first:scroll-m-20" data-title="Awesome OpenRouter"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/awesome-openrouter"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/star.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/star.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Awesome OpenRouter</span></div></div></a></li><li id="/guides/community/effect-ai-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="Effect AI SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/effect-ai-sdk"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Effect AI SDK</span></div></div></a></li><li id="/guides/community/arize" class="relative scroll-m-4 first:scroll-m-20" data-title="Arize AX"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/arize"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Arize AX</span></div></div></a></li><li id="/guides/community/langchain" class="relative scroll-m-4 first:scroll-m-20" data-title="LangChain"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/langchain"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">LangChain</span></div></div></a></li><li id="/guides/community/livekit" class="relative scroll-m-4 first:scroll-m-20" data-title="LiveKit"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/livekit"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">LiveKit</span></div></div></a></li><li id="/guides/community/langfuse" class="relative scroll-m-4 first:scroll-m-20" data-title="Langfuse"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/langfuse"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Langfuse</span></div></div></a></li><li id="/guides/community/mastra" class="relative scroll-m-4 first:scroll-m-20" data-title="Mastra"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/mastra"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Mastra</span></div></div></a></li><li id="/guides/community/openai-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="OpenAI SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/openai-sdk"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">OpenAI SDK</span></div></div></a></li><li id="/guides/community/anthropic-agent-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="Anthropic Agent SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/anthropic-agent-sdk"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Anthropic Agent SDK</span></div></div></a></li><li id="/guides/community/pydantic-ai" class="relative scroll-m-4 first:scroll-m-20" data-title="PydanticAI"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/pydantic-ai"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">PydanticAI</span></div></div></a></li><li id="/guides/community/render" class="relative scroll-m-4 first:scroll-m-20" data-title="Render"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/render"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Render</span></div></div></a></li><li id="/guides/community/replit" class="relative scroll-m-4 first:scroll-m-20" data-title="Replit"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/replit"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Replit</span></div></div></a></li><li id="/guides/community/tanstack-ai" class="relative scroll-m-4 first:scroll-m-20" data-title="TanStack AI"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/tanstack-ai"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">TanStack AI</span></div></div></a></li><li id="/guides/community/vercel-ai-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="Vercel AI SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/vercel-ai-sdk"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Vercel AI SDK</span></div></div></a></li><li id="/guides/community/xcode" class="relative scroll-m-4 first:scroll-m-20" data-title="Xcode"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/xcode"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Xcode</span></div></div></a></li><li id="/guides/community/zapier" class="relative scroll-m-4 first:scroll-m-20" data-title="Zapier"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/zapier"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Zapier</span></div></div></a></li><li id="/guides/community/infisical" class="relative scroll-m-4 first:scroll-m-20" data-title="Infisical"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/docs/guides/community/infisical"><div class="h-[1lh] flex items-center shrink-0"><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! size-4 bg-gray-400 dark:bg-gray-500" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/puzzle-piece.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Infisical</span></div></div></a></li></ul></div><script>(function () {
  try {
    if (window.__mintlifyInitialSidebarScrollDone) return;
    window.__mintlifyInitialSidebarScrollDone = true;

    var path = (window.location.pathname || '/').split('#')[0].split('?')[0];
    if (path.endsWith('/index')) path = path.slice(0, -6);
    else if (path === 'index') path = '';

    var candidates = [];
    if (path) candidates.push(path);
    if (path.startsWith('/')) candidates.push(path.slice(1));
    else candidates.push('/' + path);

    var item = null;
    for (var i = 0; i < candidates.length && !item; i++) {
      var matches = document.querySelectorAll('[id="' + candidates[i].replace(/"/g, '\\"') + '"]');
      for (var j = 0; j < matches.length; j++) {
        if (matches[j].closest('#sidebar, #sidebar-content')) {
          item = matches[j];
          break;
        }
      }
    }
    if (!item) return;

    var parent = item.closest('[data-component-part="scroll-area-viewport"]');
    if (!parent) {
      parent = item.parentElement;
      while (parent) {
        var style = getComputedStyle(parent);
        if (style.overflowY === 'auto' || style.overflowY === 'scroll') break;
        parent = parent.parentElement;
      }
    }
    if (!parent) return;

    var parentRect = parent.getBoundingClientRect();
    var itemRect = item.getBoundingClientRect();
    if (itemRect.top >= parentRect.top && itemRect.bottom <= parentRect.bottom) return;

    var itemTopRelative = itemRect.top - parentRect.top + parent.scrollTop;
    parent.scrollTop = itemTopRelative - parentRect.height / 2 + itemRect.height / 2;
  } catch (e) {}
})();</script></div></div></div></div></div></nav><main id="content-container" class="lg:flex-1 lg:min-w-0"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://openrouter.ai/#organization","name":"OpenRouter | Documentation","url":"https://openrouter.ai","logo":{"@type":"ImageObject","url":"https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-light.svg?fit=max&auto=format&n=ksNSeB_K7gD-BUDh&q=85&s=690e45873843519efe02bcbe45795dac"}},{"@type":"WebSite","@id":"https://openrouter.ai/docs#website","name":"OpenRouter | Documentation","url":"https://openrouter.ai/docs","publisher":{"@id":"https://openrouter.ai/#organization"}},{"@type":"WebPage","@id":"https://openrouter.ai/docs/guides/features/tool-calling#webpage","url":"https://openrouter.ai/docs/guides/features/tool-calling","name":"Tool & Function Calling","description":"Use tools in your prompts","dateModified":"2026-07-14T17:19:40.439Z","isPartOf":{"@id":"https://openrouter.ai/docs#website"},"breadcrumb":{"@id":"https://openrouter.ai/docs/guides/features/tool-calling#breadcrumb"}},{"@type":"BreadcrumbList","@id":"https://openrouter.ai/docs/guides/features/tool-calling#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Features","item":"https://openrouter.ai/docs/guides/features/workspaces"},{"@type":"ListItem","position":2,"name":"Tool & Function Calling","item":"https://openrouter.ai/docs/guides/features/tool-calling"}]},{"@type":["Article","TechArticle"],"@id":"https://openrouter.ai/docs/guides/features/tool-calling#article","headline":"Tool & Function Calling","name":"Tool & Function Calling","description":"Use tools in your prompts","url":"https://openrouter.ai/docs/guides/features/tool-calling","mainEntityOfPage":{"@id":"https://openrouter.ai/docs/guides/features/tool-calling#webpage"},"image":"https://openrouter.ai/dynamic-og?title=Tool%20&%20Function%20Calling&description=Use%20tools%20with%20OpenRouter","dateModified":"2026-07-14T17:19:40.439Z","publisher":{"@id":"https://openrouter.ai/#organization"},"isPartOf":{"@id":"https://openrouter.ai/docs#website"}}]}</script><script>document.documentElement.setAttribute('data-page-mode', "none");</script><span class="fixed inset-0 bg-background-light dark:bg-background-dark -z-10 pointer-events-none" id="background-color"></span><span class="block absolute dark:hidden inset-0 overflow-hidden pointer-events-none"></span><span class="hidden absolute dark:block inset-0 overflow-hidden pointer-events-none"></span><style data-custom-css-index="0" data-custom-css-path="style.css">/*
 * OpenRouter Docs — Bauhaus theme overrides
 *
 * Custom CSS for Mintlify to align with the bauhaus design system.
 * Uses Mintlify's exposed ID/element selectors for targeted styling.
 *
 * Brand palette:
 *   Ink #03080A   Cloud #FCFCFE   Grape #7624F4
 *   Volt #C8FF00  Coral #FF6849   Royal #035ADE
 */

/* ── Code font: Geist Mono ── */
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&display=swap');

/*
 * Inverse semantic pair mirrors packages/frontend/components/v2/theme.css.
 * Mintlify is a separate app, so its generated tooltip DOM uses the same
 * light Ink/Cloud and dark Cloud/Ink values through RGB channel variables.
 */
:root {
  --inverse: 3 8 10;
  --inverse-foreground: 252 252 254;
  --tooltip-background: var(--inverse);
  --tooltip-foreground: var(--inverse-foreground);
}

code,
pre,
pre code,
.code-block code,
[class*="code"] code {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

/* ── Text selection: accent tint per DESIGN.md ── */
::selection {
  background: rgb(118 36 244 / 0.14);
}

.dark ::selection,
html.dark ::selection {
  background: rgb(200 255 0 / 0.14);
  color: inherit;
}

/* ── Dark-mode accent swap: Volt (#C8FF00 = rgb(200 255 0)) per DESIGN.md ──
 * Mintlify + Tailwind use space-separated RGB: rgb(var(--primary-light) / alpha).
 * Override accent in dark mode from Grape to Volt. */
.dark,
[data-theme="dark"],
html.dark {
  --primary: 200 255 0;
  --primary-light: 200 255 0;
  --primary-dark: 200 255 0;
  --light-primary: 200 255 0;
  --primary-foreground: 3 8 10;
  --inverse: 252 252 254;
  --inverse-foreground: 3 8 10;

  /* ── Dark-mode border: Cloud at 14% per DESIGN.md ── */
  --default-border-color: rgb(252 252 254 / 0.14);
}

/* ── Border radius: bauhaus 4/6/8px scale ── */
#navbar {
  border-radius: 0;
}

/* Sidebar active item */
#sidebar a[aria-current="page"],
nav[aria-label="Pages"] a[aria-current="page"] {
  border-radius: 8px;
}

/* Cards and code blocks */
[data-component-part="code-block-root"] {
  border-radius: 8px;
}

/* ── Link styling per DESIGN.md ──
 * underline at 40% opacity of current color, full on hover, offset 2px */
a:not([class]) {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgb(0 0 0 / 0.4);
}

a:not([class]):hover {
  text-decoration-color: currentColor;
}

.dark a:not([class]),
html.dark a:not([class]) {
  text-decoration-color: rgb(255 255 255 / 0.4);
}

.dark a:not([class]):hover,
html.dark a:not([class]):hover {
  text-decoration-color: currentColor;
}

/* ── Sidebar badges: outline style ── */
.nav-tag-pill-text {
  background: transparent !important;
  color: rgb(0 0 0 / 0.5) !important;
  border: 1px solid rgb(0 0 0 / 0.2) !important;
}

.dark .nav-tag-pill-text,
html.dark .nav-tag-pill-text {
  background: transparent !important;
  color: rgb(252 252 254 / 0.5) !important;
  border: 1px solid rgb(252 252 254 / 0.2) !important;
}

/* Match the home navbar logo height (h-6 / 1.5rem). */
.nav-logo {
  height: 1.5rem;
}

/* ── Sidebar expand chevrons: raise dark-mode contrast ──
 * Collapsible group toggles render a caret whose default dark tone
 * (gray-600 on Ink) is nearly invisible, so it isn't clear which items
 * have subsections. Derive the caret from Cloud via the DESIGN.md opacity
 * scale: muted-foreground (Cloud `a0`) at rest, full Cloud (foreground) on
 * hover — no custom hex outside the brand palette. */
.dark nav[aria-label="Pages"] button[aria-expanded] svg.transition-transform,
html.dark nav[aria-label="Pages"] button[aria-expanded] svg.transition-transform {
  color: rgb(252 252 254 / 0.627);
}

.dark nav[aria-label="Pages"] button[aria-expanded]:hover svg.transition-transform,
html.dark nav[aria-label="Pages"] button[aria-expanded]:hover svg.transition-transform {
  color: rgb(252 252 254);
}

/* ── Sidebar expand chevrons: enlarge for legibility ──
 * The default caret (w-2 ≈ 8px) is easy to miss; bump its footprint so it
 * reads clearly as an expandable affordance. */
nav[aria-label="Pages"] button[aria-expanded] svg.transition-transform {
  width: 0.625rem;
  height: 0.625rem;
}

/* ── Tooltips: inverse surface pairing ──
 * Mintlify has a foreground variable for Radix tooltips but no matching
 * background variable, so both values are mirrored here from the inverse pair.
 * Radix opens tooltips as "delayed-open" on a normal hover but "instant-open"
 * when moving between triggers within its skip-delay window; cover both. */
[data-radix-popper-content-wrapper]
  > div[data-state="delayed-open"],
[data-radix-popper-content-wrapper]
  > div[data-state="instant-open"] {
  background-color: rgb(var(--tooltip-background)) !important;
  color: rgb(var(--tooltip-foreground)) !important;
}

/* ── Callout + code block alignment ──
 * A code block that is the only child of a callout body carries Mintlify's default
 * prose margins (mt-5 mb-8), which push the snippet down so it no longer lines
 * up with the top-aligned callout icon. Drop those margins so the snippet's
 * top edge aligns with the icon. */
.callout [data-component-part="callout-content"] > .code-block:first-child {
  margin-top: 0;
}

.callout [data-component-part="callout-content"] > .code-block:last-child {
  margin-bottom: 0;
}

/* ── Floating code-block buttons: opaque background ──
 * Mintlify only backs the floating buttons (report / copy / ask) with
 * gray-100/gray-800 when the code block has no fade overlay
 * (group-[:not(:has([data-fade-overlay]))]). Collapsible/expandable blocks
 * always carry a fade overlay, so the buttons stay transparent and the code
 * text bleeds through behind them. Apply the same background unconditionally
 * so the buttons are legible on every code block. */
[data-floating-buttons] button {
  background-color: rgb(241 239 245);
}

.dark [data-floating-buttons] button,
html.dark [data-floating-buttons] button {
  background-color: rgb(40 38 44);
}

/* ── Changelog: Update tags as outline pills (matches sidebar badges) ── */
[data-component-part="update-tag"] {
  border: 1px solid rgb(0 0 0 / 0.2);
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
  color: rgb(0 0 0 / 0.6);
}

.dark [data-component-part="update-tag"],
html.dark [data-component-part="update-tag"] {
  border-color: rgb(252 252 254 / 0.2);
  color: rgb(252 252 254 / 0.6);
}

/* ── Changelog: selected filter pill readability ──
 * Mintlify renders the active filter as bg-primary + text-white/90. In dark
 * mode our primary is Volt (#C8FF00), so switch the text to Ink per DESIGN.md. */
.dark #changelog-filters-content button.bg-primary,
html.dark #changelog-filters-content button.bg-primary {
  color: rgb(3 8 10 / 0.9) !important;
}

/* ── Changelog: separate inline status badges from bullet text ── */
.changelog-status-badge {
  margin-left: 0.5rem;
}

.changelog-status-badge[data-color="gray"] {
  border: 1px solid rgb(3 8 10 / 0.3) !important;
}

.dark .changelog-status-badge[data-color="gray"],
html.dark .changelog-status-badge[data-color="gray"] {
  border-color: rgb(252 252 254 / 0.4) !important;
}
</style><!--$--><!--/$--><div class="flex flex-row-reverse gap-12 box-border w-full pt-40 lg:pt-10"><div class="hidden xl:flex self-start sticky xl:flex-col max-w-[28rem] z-21 h-[calc(100vh-9.5rem)] top-[9.5rem]" id="content-side-layout"><div class="z-10 hidden xl:flex box-border max-h-full pl-10 w-[19rem]" id="table-of-contents-layout"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" id="table-of-contents" class="min-w-0 text-gray-600 text-sm leading-6 w-[16.5rem] -mt-10"><div role="presentation" data-id="base-ui-_R_1dktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] pt-10 pb-4 base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-0! w-full space-y-2"><nav aria-labelledby="_R_dktbsnlhjiuasnpfiutb_"><h2 id="_R_dktbsnlhjiuasnpfiutb_" class="m-0 font-normal"><button type="button" class="text-gray-700 dark:text-gray-300 font-medium flex items-center space-x-2 hover:text-gray-900 dark:hover:text-gray-100 transition-colors cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M2.75 14.25H15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.75 3.75H15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.75 9H8.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><span>On this page</span></button></h2><div><ul id="table-of-contents-content" class="toc"><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#request-body-examples" class="break-words py-1 block pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 font-medium dark:text-gray-400 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light [[data-active]&gt;&amp;]:[text-shadow:-0.15px_0_0_currentColor,0.15px_0_0_currentColor]">Request Body Examples</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#step-1-inference-request-with-tools" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Step 1: Inference Request with Tools</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#step-2-tool-execution-client-side" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Step 2: Tool Execution (Client-Side)</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#step-3-inference-request-with-tool-results" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Step 3: Inference Request with Tool Results</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#tool-calling-example" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Tool Calling Example</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#define-the-tool" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Define the Tool</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#tool-use-and-tool-results" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Tool use and tool results</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#interleaved-thinking" class="break-words py-1 block pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 font-medium dark:text-gray-400 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light [[data-active]&gt;&amp;]:[text-shadow:-0.15px_0_0_currentColor,0.15px_0_0_currentColor]">Interleaved Thinking</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#how-interleaved-thinking-works" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">How Interleaved Thinking Works</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#example-multi-step-research-with-reasoning" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Example: Multi-Step Research with Reasoning</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#best-practices-for-interleaved-thinking" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Best Practices for Interleaved Thinking</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#implementation-considerations" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Implementation Considerations</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#a-simple-agentic-loop" class="break-words py-1 block pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 font-medium dark:text-gray-400 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light [[data-active]&gt;&amp;]:[text-shadow:-0.15px_0_0_currentColor,0.15px_0_0_currentColor]">A Simple Agentic Loop</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#best-practices-and-advanced-patterns" class="break-words py-1 block pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 font-medium dark:text-gray-400 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light [[data-active]&gt;&amp;]:[text-shadow:-0.15px_0_0_currentColor,0.15px_0_0_currentColor]">Best Practices and Advanced Patterns</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#function-definition-guidelines" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Function Definition Guidelines</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#streaming-with-tool-calls" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Streaming with Tool Calls</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#tool-choice-configuration" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Tool Choice Configuration</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#parallel-tool-calls" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Parallel Tool Calls</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#multi-tool-workflows" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Multi-Tool Workflows</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#reliability-tracking" class="group flex items-start break-words py-1 pl-[calc(var(--toc-padding-left)+var(--toc-focus-padding,0rem))] whitespace-pre-wrap focus-visible:[--toc-focus-padding:0.25rem] focus-visible:-ml-1 focus-visible:-outline-offset-2 text-gray-500 [li:not([data-active])&gt;&amp;:hover]:text-gray-900 dark:text-gray-400 dark:[li:not([data-active])&gt;&amp;:hover]:text-gray-300 [[data-active]&gt;&amp;]:text-primary dark:[[data-active]&gt;&amp;]:text-primary-light">Reliability Tracking</a></li></ul></li></ul></div></nav></div></div></div></div></div><div class="relative grow box-border flex-col w-full mx-auto px-1 lg:pl-[5.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" id="content-area"><header id="header" class="relative leading-none @container/page-header"><div class="mt-0.5 space-y-2.5"><div class="eyebrow h-5 text-primary dark:text-primary-light text-sm font-semibold">Features</div><div class="flex flex-col sm:flex-row items-start sm:items-center relative gap-2 min-w-0"><h1 id="page-title" class="text-3xl sm:text-4xl text-gray-900 tracking-tight dark:text-gray-200 [overflow-wrap:anywhere] font-semibold">Tool &amp; Function Calling</h1><div id="page-context-menu" class="items-center shrink-0 min-w-[156px] justify-end ml-auto hidden @[520px]/page-header:flex"><button id="page-context-menu-button" class="rounded-l-xl px-3 text-gray-700 dark:text-gray-300 py-1.5 border border-gray-200 dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5 border-r-0" aria-label="Copy page"><div class="flex items-center gap-2 text-sm text-center font-medium"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><span class="grid"><span aria-hidden="true" class="invisible col-start-1 row-start-1">Copy page</span><span class="col-start-1 row-start-1">Copy page</span></span></div></button><button type="button" tabindex="0" aria-haspopup="menu" id="base-ui-_R_1mshlktbsnlhjiuasnpfiutb_" aria-label="More actions" class="group disabled:pointer-events-none [&amp;&gt;span]:line-clamp-1 overflow-hidden group focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-primary-light py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border flex items-center justify-center h-[34px] border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 rotate-90"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div></div><div class="mt-2 text-lg prose prose-gray dark:prose-invert [&amp;&gt;*]:[overflow-wrap:anywhere]"><p>Use tools in your prompts</p></div><div id="page-context-menu" class="flex items-center shrink-0 min-w-[156px] mt-3 @[520px]/page-header:hidden"><button id="page-context-menu-button" class="rounded-l-xl px-3 text-gray-700 dark:text-gray-300 py-1.5 border border-gray-200 dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5 border-r-0" aria-label="Copy page"><div class="flex items-center gap-2 text-sm text-center font-medium"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><span class="grid"><span aria-hidden="true" class="invisible col-start-1 row-start-1">Copy page</span><span class="col-start-1 row-start-1">Copy page</span></span></div></button><button type="button" tabindex="0" aria-haspopup="menu" id="base-ui-_R_3dhlktbsnlhjiuasnpfiutb_" aria-label="More actions" class="group disabled:pointer-events-none [&amp;&gt;span]:line-clamp-1 overflow-hidden group focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-primary-light py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border flex items-center justify-center h-[34px] border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3 transition-transform text-gray-400 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-400 shrink-0 rotate-90"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></header><div class="mdx-content @container/columns-container relative mt-8 prose prose-gray dark:prose-invert [contain:inline-size] isolate empty:hidden mb-14" data-page-title="Tool &amp; Function Calling" data-page-href="/guides/features/tool-calling" id="content"><span data-as="p">Tool calls (also known as function calls) give an LLM access to external tools. The LLM does not call the tools directly. Instead, it suggests the tool to call. The user then calls the tool separately and provides the results back to the LLM. Finally, the LLM formats the response into an answer to the user’s original question.</span>
<span data-as="p">OpenRouter standardizes the tool calling interface across models and providers, making it easy to integrate external tools with any supported model.</span>
<span data-as="p"><strong>Supported Models</strong>: You can find models that support tool calling by filtering on <a href="https://openrouter.ai/models?supported_parameters=tools" target="_blank" rel="noreferrer" class="link">openrouter.ai/models?supported_parameters=tools</a>.</span>
<span data-as="p">If you prefer to learn from a full end-to-end example, keep reading.</span>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="request-body-examples"><div class="absolute" tabindex="-1"><a href="#request-body-examples" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Request Body Examples</span></h2>
<span data-as="p">Tool calling with OpenRouter involves three key steps. Here are the essential request body formats for each step:</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="step-1-inference-request-with-tools"><div class="absolute" tabindex="-1"><a href="#step-1-inference-request-with-tools" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 1: Inference Request with Tools</span></h3>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="29" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ul1sllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v51sllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vl1sllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-_____model____google"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:190px;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_p1sllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="29"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;google/gemini-3-flash-preview&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;user&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;What are the titles of some James Joyce books?&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_gutenberg_books&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Search for books in the Project Gutenberg library&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;parameters&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;search_terms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;array&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;items&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;List of search terms to find books&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">            }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">          },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_terms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div data-component-part="code-block-footer" class="px-3 py-1 flex items-center text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><button data-component-part="code-block-footer-button" class="flex-1 gap-1.5 flex items-center py-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3.5 shrink-0 text-gray-500 dark:text-gray-400"><path d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.25 9.5C3.52614 9.5 3.75 9.27614 3.75 9C3.75 8.72386 3.52614 8.5 3.25 8.5C2.97386 8.5 2.75 8.72386 2.75 9C2.75 9.27614 2.97386 9.5 3.25 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.75 9.5C15.0261 9.5 15.25 9.27614 15.25 9C15.25 8.72386 15.0261 8.5 14.75 8.5C14.4739 8.5 14.25 8.72386 14.25 9C14.25 9.27614 14.4739 9.5 14.75 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg>See all 29 lines</button></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="step-2-tool-execution-client-side"><div class="absolute" tabindex="-1"><a href="#step-2-tool-execution-client-side" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 2: Tool Execution (Client-Side)</span></h3>
<span data-as="p">After receiving the model’s response with <code>tool_calls</code>, execute the requested tool locally and prepare the result:</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="javascript"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ul2kllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v52kllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vl2kllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-javascript-code-___Model_responds_wi"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_p2kllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="javascript"><code language="javascript" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Model responds with tool_calls, you execute the tool locally</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> toolResult</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#C586C0"> await</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> searchGutenbergBooks</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">([</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;James&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Joyce&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]);</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="step-3-inference-request-with-tool-results"><div class="absolute" tabindex="-1"><a href="#step-3-inference-request-with-tool-results" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 3: Inference Request with Tool Results</span></h3>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="48" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ul34llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v534llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vl34llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-_____model____google"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:190px;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_p34llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="48"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;google/gemini-3-flash-preview&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;user&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;What are the titles of some James Joyce books?&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;assistant&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#569CD6">null</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;tool_calls&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;call_abc123&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_gutenberg_books&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;arguments&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;{</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">search_terms</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">: [</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">James</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">, </span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">Joyce</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">]}&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">          }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      ]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;tool&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;tool_call_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;call_abc123&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;[{</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">id</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">: 4300, </span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">title</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">: </span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">Ulysses</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">, </span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">authors</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">: [{</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">name</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">: </span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">Joyce, James</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\&quot;</span><span style="color:#0A3069;--shiki-dark:#CE9178">}]}]&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_gutenberg_books&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Search for books in the Project Gutenberg library&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;parameters&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;search_terms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;array&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;items&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">              &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;List of search terms to find books&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">            }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">          },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_terms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div data-component-part="code-block-footer" class="px-3 py-1 flex items-center text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><button data-component-part="code-block-footer-button" class="flex-1 gap-1.5 flex items-center py-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3.5 shrink-0 text-gray-500 dark:text-gray-400"><path d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.25 9.5C3.52614 9.5 3.75 9.27614 3.75 9C3.75 8.72386 3.52614 8.5 3.25 8.5C2.97386 8.5 2.75 8.72386 2.75 9C2.75 9.27614 2.97386 9.5 3.25 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.75 9.5C15.0261 9.5 15.25 9.27614 15.25 9C15.25 8.72386 15.0261 8.5 14.75 8.5C14.4739 8.5 14.25 8.72386 14.25 9C14.25 9.27614 14.4739 9.5 14.75 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg>See all 48 lines</button></div></div>
<span data-as="p"><strong>Note</strong>: The <code>tools</code> parameter must be included in every request (Steps 1 and 3) so the router can validate the tool schema on each call.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="tool-calling-example"><div class="absolute" tabindex="-1"><a href="#tool-calling-example" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Tool Calling Example</span></h3>
<span data-as="p">Here is Python code that gives LLMs the ability to call an external API — in this case Project Gutenberg, to search for books.</span>
<span data-as="p">First, let’s do some basic setup:</span>
<!-- -->
<h3 class="flex whitespace-pre-wrap group font-semibold" id="define-the-tool"><div class="absolute" tabindex="-1"><a href="#define-the-tool" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Define the Tool</span></h3>
<span data-as="p">Next, we define the tool that we want to call. Remember, the tool is going to get <em>requested</em> by the LLM, but the code we are writing here is ultimately responsible for executing the call and returning the results to the LLM.</span>
<!-- -->
<span data-as="p">Note that the “tool” is just a normal function. We then write a JSON “spec” compatible with the OpenAI function calling parameter. We’ll pass that spec to the LLM so that it knows this tool is available and how to use it. It will request the tool when needed, along with any arguments. We’ll then marshal the tool call locally, make the function call, and return the results to the LLM.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="tool-use-and-tool-results"><div class="absolute" tabindex="-1"><a href="#tool-use-and-tool-results" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Tool use and tool results</span></h3>
<span data-as="p">Let’s make the first OpenRouter API call to the model:</span>
<!-- -->
<span data-as="p">The LLM responds with a finish reason of <code>tool_calls</code>, and a <code>tool_calls</code> array. In a generic LLM response-handler, you would want to check the <code>finish_reason</code> before processing tool calls, but here we will assume it’s the case. Let’s keep going, by processing the tool call:</span>
<!-- -->
<span data-as="p">The messages array now has:</span>
<ol>
<li>Our original request</li>
<li>The LLM’s response (containing a tool call request)</li>
<li>The result of the tool call (a json object returned from the Project Gutenberg API)</li>
</ol>
<span data-as="p">Now, we can make a second OpenRouter API call, and hopefully get our result!</span>
<!-- -->
<span data-as="p">The output will be something like:</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="8" language="text"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ul84llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v584llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vl84llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-text-code-Here_are_some_books_"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_p84llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="text"><code language="text" numberOfLines="8"><span class="line"><span>Here are some books by James Joyce:</span></span>
<span class="line"><span></span></span>
<span class="line"><span>*   *Ulysses*</span></span>
<span class="line"><span>*   *Dubliners*</span></span>
<span class="line"><span>*   *A Portrait of the Artist as a Young Man*</span></span>
<span class="line"><span>*   *Chamber Music*</span></span>
<span class="line"><span>*   *Exiles: A Play in Three Acts*</span></span>
<span class="line"><span></span></span></code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<span data-as="p">We did it! We’ve successfully used a tool in a prompt.</span>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="interleaved-thinking"><div class="absolute" tabindex="-1"><a href="#interleaved-thinking" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Interleaved Thinking</span></h2>
<span data-as="p">Interleaved thinking allows models to reason between tool calls, enabling more sophisticated decision-making after receiving tool results. This feature helps models chain multiple tool calls with reasoning steps in between and make nuanced decisions based on intermediate results.</span>
<span data-as="p"><strong>Important</strong>: Interleaved thinking increases token usage and response latency. Consider your budget and performance requirements when enabling this feature.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="how-interleaved-thinking-works"><div class="absolute" tabindex="-1"><a href="#how-interleaved-thinking-works" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">How Interleaved Thinking Works</span></h3>
<span data-as="p">With interleaved thinking, the model can:</span>
<ul>
<li>Reason about the results of a tool call before deciding what to do next</li>
<li>Chain multiple tool calls with reasoning steps in between</li>
<li>Make more nuanced decisions based on intermediate results</li>
<li>Provide transparent reasoning for its tool selection process</li>
</ul>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="example-multi-step-research-with-reasoning"><div class="absolute" tabindex="-1"><a href="#example-multi-step-research-with-reasoning" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Example: Multi-Step Research with Reasoning</span></h3>
<span data-as="p">Here’s an example showing how a model might use interleaved thinking to research a topic across multiple sources:</span>
<span data-as="p"><strong>Initial Request:</strong></span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="41" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulasllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5asllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlasllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-_____model____anthro"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:190px;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pasllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="41"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic/claude-sonnet-4.5&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;user&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Research the environmental impact of electric vehicles and provide a comprehensive analysis.&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_academic_papers&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Search for academic papers on a given topic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;parameters&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;query&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;field&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">          },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;query&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;get_latest_statistics&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Get latest statistics on a topic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;parameters&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;topic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">            &quot;year&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;integer&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">          },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;topic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div data-component-part="code-block-footer" class="px-3 py-1 flex items-center text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><button data-component-part="code-block-footer-button" class="flex-1 gap-1.5 flex items-center py-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3.5 shrink-0 text-gray-500 dark:text-gray-400"><path d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.25 9.5C3.52614 9.5 3.75 9.27614 3.75 9C3.75 8.72386 3.52614 8.5 3.25 8.5C2.97386 8.5 2.75 8.72386 2.75 9C2.75 9.27614 2.97386 9.5 3.25 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.75 9.5C15.0261 9.5 15.25 9.27614 15.25 9C15.25 8.72386 15.0261 8.5 14.75 8.5C14.4739 8.5 14.25 8.72386 14.25 9C14.25 9.27614 14.4739 9.5 14.75 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg>See all 41 lines</button></div></div>
<span data-as="p"><strong>Model’s Reasoning and Tool Calls:</strong></span>
<ol>
<li>
<span data-as="p"><strong>Initial Thinking</strong>: “I need to research electric vehicle environmental impact. Let me start with academic papers to get peer-reviewed research.”</span>
</li>
<li>
<span data-as="p"><strong>First Tool Call</strong>: <code>search_academic_papers({&quot;query&quot;: &quot;electric vehicle lifecycle environmental impact&quot;, &quot;field&quot;: &quot;environmental science&quot;})</code></span>
</li>
<li>
<span data-as="p"><strong>After First Tool Result</strong>: “The papers show mixed results on manufacturing impact. I need current statistics to complement this academic research.”</span>
</li>
<li>
<span data-as="p"><strong>Second Tool Call</strong>: <code>get_latest_statistics({&quot;topic&quot;: &quot;electric vehicle carbon footprint&quot;, &quot;year&quot;: 2024})</code></span>
</li>
<li>
<span data-as="p"><strong>After Second Tool Result</strong>: “Now I have both academic research and current data. Let me search for manufacturing-specific studies to address the gaps I found.”</span>
</li>
<li>
<span data-as="p"><strong>Third Tool Call</strong>: <code>search_academic_papers({&quot;query&quot;: &quot;electric vehicle battery manufacturing environmental cost&quot;, &quot;field&quot;: &quot;materials science&quot;})</code></span>
</li>
<li>
<span data-as="p"><strong>Final Analysis</strong>: Synthesizes all gathered information into a comprehensive response.</span>
</li>
</ol>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="best-practices-for-interleaved-thinking"><div class="absolute" tabindex="-1"><a href="#best-practices-for-interleaved-thinking" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Best Practices for Interleaved Thinking</span></h3>
<ul>
<li><strong>Clear Tool Descriptions</strong>: Provide detailed descriptions so the model can reason about when to use each tool</li>
<li><strong>Structured Parameters</strong>: Use well-defined parameter schemas to help the model make precise tool calls</li>
<li><strong>Context Preservation</strong>: Maintain conversation context across multiple tool interactions</li>
<li><strong>Error Handling</strong>: Design tools to provide meaningful error messages that help the model adjust its approach</li>
</ul>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="implementation-considerations"><div class="absolute" tabindex="-1"><a href="#implementation-considerations" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Implementation Considerations</span></h3>
<span data-as="p">When implementing interleaved thinking:</span>
<ul>
<li>Models may take longer to respond due to additional reasoning steps</li>
<li>Token usage will be higher due to the reasoning process</li>
<li>The quality of reasoning depends on the model’s capabilities</li>
<li>Some models may be better suited for this approach than others</li>
</ul>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="a-simple-agentic-loop"><div class="absolute" tabindex="-1"><a href="#a-simple-agentic-loop" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">A Simple Agentic Loop</span></h2>
<span data-as="p">In the example above, the calls are made explicitly and sequentially. To handle a wide variety of user inputs and tool calls, you can use an agentic loop.</span>
<span data-as="p">Here’s an example of a simple agentic loop (using the same <code>tools</code> and initial <code>messages</code> as above):</span>
<!-- -->
<h2 class="flex whitespace-pre-wrap group font-semibold" id="best-practices-and-advanced-patterns"><div class="absolute" tabindex="-1"><a href="#best-practices-and-advanced-patterns" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Best Practices and Advanced Patterns</span></h2>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="function-definition-guidelines"><div class="absolute" tabindex="-1"><a href="#function-definition-guidelines" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Function Definition Guidelines</span></h3>
<span data-as="p">When defining tools for LLMs, follow these best practices:</span>
<span data-as="p"><strong>Clear and Descriptive Names</strong>: Use descriptive function names that clearly indicate the tool’s purpose.</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulesllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5esllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlesllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Good__Clear_and_s"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pesllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Good: Clear and specific</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{ </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;get_weather_forecast&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulf4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5f4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlf4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Avoid__Too_vague_"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pf4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Avoid: Too vague</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{ </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;weather&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<span data-as="p"><strong>Comprehensive Descriptions</strong>: Provide detailed descriptions that help the model understand when and how to use the tool.</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="19" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulfkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5fkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlfkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-_____description____"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pfkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="19"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Get current weather conditions and 5-day forecast for a specific location. Supports cities, zip codes, and coordinates.&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;parameters&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;location&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;City name, zip code, or coordinates (lat,lng). Examples: &#x27;New York&#x27;, &#x27;10001&#x27;, &#x27;40.7128,-74.0060&#x27;&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;units&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;enum&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;celsius&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;fahrenheit&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Temperature unit preference&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;default&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;celsius&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;location&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="streaming-with-tool-calls"><div class="absolute" tabindex="-1"><a href="#streaming-with-tool-calls" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Streaming with Tool Calls</span></h3>
<span data-as="p">When using streaming responses with tool calls, handle the different content types appropriately:</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="40" language="typescript"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulgcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5gcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlgcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-typescript-code-const_stream___await"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:190px;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pgcllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="typescript"><code language="typescript" numberOfLines="40"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> stream</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#C586C0"> await</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> fetch</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;/api/chat/completions&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  method:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;POST&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;Content-Type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  body:</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> JSON</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">stringify</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">({</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    model:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;anthropic/claude-sonnet-4.5&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    messages:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> messages</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    tools:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> tools</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    stream:</span><span style="color:#0550AE;--shiki-dark:#569CD6"> true</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  })</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> reader</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> stream</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">body</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">getReader</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">let</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> toolCalls</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> [];</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">while</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#0550AE;--shiki-dark:#569CD6">true</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0550AE;--shiki-dark:#4FC1FF">done</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0550AE;--shiki-dark:#4FC1FF">value</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#CF222E;--shiki-dark:#C586C0"> await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> reader</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">read</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">done</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    break</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> chunk</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> TextDecoder</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">().</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">decode</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">value</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> lines</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> chunk</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">split</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\n</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">).</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">filter</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#953800;--shiki-dark:#9CDCFE">line</span><span style="color:#CF222E;--shiki-dark:#569CD6"> =&gt;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> line</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">trim</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">());</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  for</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> line</span><span style="color:#CF222E;--shiki-dark:#569CD6"> of</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> lines</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">line</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">startsWith</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;data: &#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)) {</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">      const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> data</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> JSON</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">parse</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">line</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">slice</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">6</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">      if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">data</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">choices</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">].</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">delta</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">tool_calls</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">        toolCalls</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">push</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">...</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">data</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">choices</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">].</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">delta</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">tool_calls</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">      if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">data</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">choices</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">].</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">delta</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">finish_reason</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;tool_calls&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        await</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> handleToolCalls</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">toolCalls</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      } </span><span style="color:#CF222E;--shiki-dark:#C586C0">else</span><span style="color:#CF222E;--shiki-dark:#C586C0"> if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">data</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">choices</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">].</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">delta</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">finish_reason</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;stop&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">        // Regular completion without tool calls</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        break</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div data-component-part="code-block-footer" class="px-3 py-1 flex items-center text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><button data-component-part="code-block-footer-button" class="flex-1 gap-1.5 flex items-center py-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3.5 shrink-0 text-gray-500 dark:text-gray-400"><path d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.25 9.5C3.52614 9.5 3.75 9.27614 3.75 9C3.75 8.72386 3.52614 8.5 3.25 8.5C2.97386 8.5 2.75 8.72386 2.75 9C2.75 9.27614 2.97386 9.5 3.25 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.75 9.5C15.0261 9.5 15.25 9.27614 15.25 9C15.25 8.72386 15.0261 8.5 14.75 8.5C14.4739 8.5 14.25 8.72386 14.25 9C14.25 9.27614 14.4739 9.5 14.75 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg>See all 40 lines</button></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="tool-choice-configuration"><div class="absolute" tabindex="-1"><a href="#tool-choice-configuration" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Tool Choice Configuration</span></h3>
<span data-as="p">Control tool usage with the <code>tool_choice</code> parameter:</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulh4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5h4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlh4llktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Let_model_decide_"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_ph4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Let model decide (default)</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{ </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;tool_choice&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;auto&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulhcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5hcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlhcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Disable_tool_usag"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_phcllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Disable tool usage</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{ </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;tool_choice&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;none&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="7" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulhkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5hkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlhkllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Force_specific_to"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_phkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="7"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Force specific tool</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;tool_choice&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_database&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="parallel-tool-calls"><div class="absolute" tabindex="-1"><a href="#parallel-tool-calls" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Parallel Tool Calls</span></h3>
<span data-as="p">Control whether multiple tools can be called simultaneously with the <code>parallel_tool_calls</code> parameter (default is true for most models):</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="2" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_ulicllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5icllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vlicllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-___Disable_parallel_"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:auto;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_picllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="2"><span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">// Disable parallel tool calls - tools will be called sequentially</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{ </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;parallel_tool_calls&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#569CD6">false</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }</span></span>
</code></pre></div></div></div></div><div class="code-block-fade-overlay print:hidden" data-fade-overlay="true" aria-hidden="true" style="--fade-color-light:#ffffff;--fade-color-dark:#0B0C0E"></div></div>
<span data-as="p">When <code>parallel_tool_calls</code> is <code>false</code>, the model will only request one tool call at a time instead of potentially multiple calls in parallel.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="multi-tool-workflows"><div class="absolute" tabindex="-1"><a href="#multi-tool-workflows" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Multi-Tool Workflows</span></h3>
<span data-as="p">Design tools that work well together:</span>
<div class="code-block mt-5 mb-8 not-prose rounded-2xl relative group min-w-0 print:print-color-exact text-gray-950 dark:text-gray-50 codeblock-light border border-gray-950/10 dark:border-white/10 dark:twoslash-dark bg-transparent dark:bg-transparent" lines="true" numberOfLines="25" language="json"><div data-floating-buttons="true" class="absolute top-3 right-4 flex items-center gap-1.5 print:hidden"><div class="z-10 select-none" id="base-ui-_R_uljcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/code-snippet-feedback-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="code-snippet-feedback-button" aria-label="Report incorrect code"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/code-snippet-feedback-button:text-gray-500 dark:text-white/40 dark:group-hover/code-snippet-feedback-button:text-white/60"><path d="M9 5.431V9.569" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9 11.417C8.449 11.417 8 11.866 8 12.417C8 12.968 8.449 13.417 9 13.417C9.551 13.417 10 12.968 10 12.417C10 11.866 9.551 11.417 9 11.417Z" fill="currentColor" stroke="none"></path><path d="M10.968 2.25H7.03301C6.50301 2.25 5.99401 2.461 5.61901 2.836L2.83701 5.618C2.46201 5.993 2.25101 6.502 2.25101 7.032V10.967C2.25101 11.497 2.46201 12.006 2.83701 12.381L5.61901 15.163C5.99401 15.538 6.50301 15.749 7.03301 15.749H10.968C11.498 15.749 12.007 15.538 12.382 15.163L15.164 12.381C15.539 12.006 15.75 11.497 15.75 10.967V7.032C15.75 6.502 15.539 5.993 15.164 5.618L12.382 2.836C12.007 2.461 11.498 2.25 10.968 2.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_v5jcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" data-testid="copy-code-button" aria-label="Copy the contents from the code block"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/copy-button:text-gray-500 dark:text-white/40 dark:group-hover/copy-button:text-white/60"><path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><span role="status" class="sr-only"></span></div><div class="z-10 select-none" id="base-ui-_R_vljcllktbsnlhjiuasnpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/ask-assistant-button in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-100 dark:in-data-floating-buttons:group-[:not(:has([data-fade-overlay]))]:bg-gray-800" id="ask-assistant-code-block-button" aria-label="Ask Assistant" data-chat-payload-element-id="lang-json-code-_____tools__________"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-4 shrink-0 text-gray-400 group-hover/ask-assistant-button:text-gray-500 dark:text-white/40 dark:group-hover/ask-assistant-button:text-white/60"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:190px;background-color:#ffffff;--shiki-dark-bg:#0B0C0E" data-component-part="code-block-root" class="w-0 min-w-full max-w-full h-full dark:bg-codeblock text-sm leading-6 transition-[height] duration-300 ease-in-out code-block-background **:ring-0 **:outline-0 **:focus:ring-0 **:focus:outline-0 rounded-2xl bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_pjcllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-4 overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="min-w-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre leading-6"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="json"><code language="json" numberOfLines="25"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;search_products&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Search for products in the catalog&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;get_product_details&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Get detailed information about a specific product&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;function&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;check_inventory&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Check current inventory levels for a product&quot;</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  ]</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
</code></pre></div></div></div></div><div data-component-part="code-block-footer" class="px-3 py-1 flex items-center text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><button data-component-part="code-block-footer-button" class="flex-1 gap-1.5 flex items-center py-1.5"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3.5 shrink-0 text-gray-500 dark:text-gray-400"><path d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M3.25 9.5C3.52614 9.5 3.75 9.27614 3.75 9C3.75 8.72386 3.52614 8.5 3.25 8.5C2.97386 8.5 2.75 8.72386 2.75 9C2.75 9.27614 2.97386 9.5 3.25 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M14.75 9.5C15.0261 9.5 15.25 9.27614 15.25 9C15.25 8.72386 15.0261 8.5 14.75 8.5C14.4739 8.5 14.25 8.72386 14.25 9C14.25 9.27614 14.4739 9.5 14.75 9.5Z" fill="currentColor" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg>See all 25 lines</button></div></div>
<span data-as="p">This allows the model to naturally chain operations: search → get details → check inventory.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="reliability-tracking"><div class="absolute" tabindex="-1"><a href="#reliability-tracking" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Reliability Tracking</span></h3>
<span data-as="p">OpenRouter tracks how reliably each provider completes tool calls and surfaces this as the <strong>Tool Call Error Rate</strong> on the Performance tab of every model page. The same signal drives <a class="link" href="/docs/guides/routing/auto-exacto">Auto Exacto</a> provider ordering on tool-calling requests. For the exact validator, JSON Schema draft, regex semantics, and per-tool-call classification, see <a class="link" href="/docs/guides/routing/auto-exacto#how-tool-calling-success-rate-is-measured">How Tool-Calling Success Rate Is Measured</a>.</span>
<span data-as="p">For more details on OpenRouter’s message format and tool parameters, see the <a class="link" href="/docs/api_reference/overview">API Reference</a>.</span></div><nav id="pagination" aria-label="Pagination" class="px-0.5 flex items-center gap-6 text-sm font-semibold text-gray-700 dark:text-gray-200"><a rel="prev" aria-label="Previous: Response Caching" data-component-part="pagination-prev" class="group flex items-center min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-primary-light gap-3 rounded-sm pagination-prev" href="/docs/guides/features/response-caching"><svg viewBox="0 0 3 6" aria-hidden="true" data-component-part="pagination-chevron" class="h-1.5 shrink-0 stroke-gray-400 overflow-visible group-hover:stroke-gray-600 dark:group-hover:stroke-gray-300"><path d="M3 0L0 3L3 6" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><div class="truncate group-hover:text-gray-900 dark:group-hover:text-white" data-component-part="pagination-title">Response Caching</div></a><a rel="next" aria-label="Next: Overview" data-component-part="pagination-next" class="group flex items-center min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary dark:focus-visible:outline-primary-light gap-3 rounded-sm ml-auto pagination-next" href="/docs/guides/features/server-tools"><div class="truncate group-hover:text-gray-900 dark:group-hover:text-white" data-component-part="pagination-title">Overview</div><svg viewBox="0 0 3 6" aria-hidden="true" data-component-part="pagination-chevron" class="h-1.5 shrink-0 stroke-gray-400 overflow-visible group-hover:stroke-gray-600 dark:group-hover:stroke-gray-300 rotate-180"><path d="M3 0L0 3L3 6" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg></a></nav><div class="left-0 right-0 sticky bottom-0 w-full overflow-hidden z-20 pointer-events-none print:hidden"><div class="chat-assistant-floating-input w-full group/assistant-bar relative before:content-[&quot;&quot;] before:absolute before:left-0 before:right-0 before:top-1/2 before:h-[200px] before:bg-transparent dark:before:bg-transparent translate-y-[100px] opacity-0"><div class="relative pb-4 sm:pb-6"><div class="flex flex-col w-full rounded-2xl pointer-events-auto bg-background-light dark:bg-background-dark border border-gray-200 dark:border-white/30 focus-within:border-primary dark:focus-within:border-primary-light transition-colors max-w-[386px] mx-auto"><div class="relative flex items-end"><textarea id="chat-assistant-textarea" aria-label="Ask a question..." autoComplete="off" placeholder="Ask a question..." class="chat-assistant-input w-full bg-transparent border-0 peer/input text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 outline-hidden! focus:outline-hidden! focus:ring-0 py-2.5 pl-3.5 pr-10 font-bodyWeight text-sm" style="resize:none"></textarea><span class="absolute right-11 bottom-3 text-xs font-medium text-gray-400 dark:text-gray-500 select-none pointer-events-none peer-focus/input:hidden hidden sm:inline">⌘<!-- -->I</span><button class="chat-assistant-send-button flex justify-center items-center rounded-full p-1 size-6 bg-primary/30 dark:bg-primary-dark/30 absolute right-2.5 bottom-2" aria-label="Send message" disabled=""><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-2.5 shrink-0 text-white dark:text-white"><path d="M9.0 1.5754L8.9999 16.4171" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.2563 8.319L8.9999 1.5754L15.7435 8.3191" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div></div></div></div><footer id="footer" class="flex gap-12 justify-between pt-10 border-t border-gray-100 sm:flex dark:border-gray-800/50 pb-28"></footer></div></div></main></div><!--$--><!--/$--></div><div data-assistant-sheet-container="" class="sticky shrink-0 z-22 bg-background-light dark:bg-background-dark mt-(--banner-height,0px) top-(--banner-height,0px) h-[calc(100vh-var(--banner-height,0px))] max-lg:hidden print:hidden" style="width:var(--assistant-sheet-width, 0px);overflow:hidden"><div class="absolute left-0 top-0 bottom-0 w-px z-10 cursor-col-resize after:content-[&quot;&quot;] after:absolute after:inset-y-0 after:-inset-x-2 after:select-none bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700"></div><div id="chat-assistant-sheet" class="flex flex-col overflow-hidden shrink-0 relative h-full bg-background-light dark:bg-background-dark chat-assistant-sheet" aria-hidden="true"><div class="w-full flex flex-col flex-1 min-h-0 lg:pt-3"><div class="chat-assistant-sheet-header flex items-center justify-between pb-3 px-4"><div class="flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="size-5 text-primary dark:text-primary-light shrink-0" aria-hidden="true"><path d="M5.65799 2.99L4.39499 2.569L3.97399 1.306C3.83699 0.898 3.16199 0.898 3.02499 1.306L2.60399 2.569L1.34099 2.99C1.13699 3.058 0.998993 3.249 0.998993 3.464C0.998993 3.679 1.13699 3.87 1.34099 3.938L2.60399 4.359L3.02499 5.622C3.09299 5.826 3.28499 5.964 3.49999 5.964C3.71499 5.964 3.90599 5.826 3.97499 5.622L4.39599 4.359L5.65899 3.938C5.86299 3.87 6.00099 3.679 6.00099 3.464C6.00099 3.249 5.86199 3.058 5.65799 2.99Z" fill="currentColor" stroke="none"></path><path d="M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg><span class="font-medium text-gray-900 dark:text-gray-100">Assistant</span></div><div class="flex items-center gap-1"><button class="group hover:bg-gray-100 dark:hover:bg-white/10 p-1.5 rounded-lg" aria-label="Maximize assistant panel"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-4 sm:size-3.5 text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-300 shrink-0"><path d="M10.75 2.75H15.25V7.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M15.25 2.75L10.75 7.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.75 10.75V15.25H7.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.75 15.25L7.25 10.75" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><button class="group hover:bg-gray-100 dark:hover:bg-white/10 p-1.5 rounded-lg" aria-label="Close assistant panel"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-[20px] sm:size-4 text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-300 shrink-0"><path d="M14 4L4 14" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M4 4L14 14" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div><div id="chat-content" class="chat-assistant-sheet-content flex flex-col-reverse flex-1 overflow-y-auto relative px-5 min-h-0"><div class="grow"></div><div class="h-full flex flex-col justify-between"><div class="mt-4 flex flex-col items-center text-sm"><div class="mx-8 text-center text-gray-400 dark:text-gray-600 text-xs chat-assistant-disclaimer-text">Responses are generated using AI and may contain mistakes.</div></div></div></div><div class="px-4 pb-4 shrink-0"><div class=""><div class="flex flex-col w-full rounded-2xl pointer-events-auto bg-background-light dark:bg-background-dark border border-gray-200 dark:border-white/30 focus-within:border-primary dark:focus-within:border-primary-light transition-colors"><div class="relative flex items-end"><textarea id="chat-assistant-textarea" aria-label="Ask a question..." autoComplete="off" placeholder="Ask a question..." class="chat-assistant-input w-full bg-transparent border-0 peer/input text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 outline-hidden! focus:outline-hidden! focus:ring-0 py-2.5 pl-3.5 pr-10 font-bodyWeight text-sm pb-0!" style="resize:none" rows="2"></textarea></div><div class="flex items-center justify-between px-2 pb-2"><input type="file" accept="image/*,.pdf,.js,.jsx,.ts,.tsx,.mjs,.cjs,.md,.mdx,.json,.html,.css,.py,.csv,.txt,.yaml,.yml,.xml,.sql,.sh,.bash,.zsh,.graphql,.gql,.toml,.env,.go,.rs,.rb,.java,.kt,.swift,.c,.cpp,.cc,.h,.hpp,.cs,.php,.dart,.lua,.r,.scala,.ini,.cfg,.conf,.log,.dockerfile,.makefile,.gitignore" multiple="" class="hidden"/><button type="button" class="p-1 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/10" aria-label="Add attachment"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="size-3.5 shrink-0"><path d="M7.75 5V11.75C7.75 12.578 8.422 13.25 9.25 13.25C10.078 13.25 10.75 12.578 10.75 11.75V4.75C10.75 3.093 9.407 1.75 7.75 1.75C6.093 1.75 4.75 3.093 4.75 4.75V11.75C4.75 14.235 6.765 16.25 9.25 16.25C11.735 16.25 13.75 14.235 13.75 11.75V5" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button><button class="chat-assistant-send-button flex justify-center items-center rounded-full p-1 size-6 bg-primary/30 dark:bg-primary-dark/30" aria-label="Send message" disabled=""><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-2.5 shrink-0 text-white dark:text-white"><path d="M9.0 1.5754L8.9999 16.4171" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M2.2563 8.319L8.9999 1.5754L15.7435 8.3191" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></button></div></div></div></div></div></div></div></div></div><script src="/docs/_next/static/chunks/6d55b684068fd47e.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n9:I[168027,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n:HL[\"/docs/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"style\"]\n:HL[\"/docs/_next/static/chunks/130071cec1814339.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"style\"]\n:HL[\"/docs/_next/static/media/83afe278b6a6bb3c.p.3a6ba036.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/docs/_next/static/media/PaperMono_Variable.p.aa32f7a0.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/docs/_next/static/media/f67ad414ed34149c.p.84166d94.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"DJEWuMed6amFoZzQ1598Z\",\"p\":\"/docs\",\"c\":[\"\",\"_sites\",\"openrouter-d02e98a0\",\"guides\",\"features\",\"tool-calling\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"%5Fsites\",{\"children\":[[\"subdomain\",\"openrouter-d02e98a0\",\"d\"],{\"children\":[\"(multitenant)\",{\"children\":[[\"slug\",\"guides/features/tool-calling\",\"oc\"],{\"children\":[\"__PAGE__\",{}]}]}]}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/docs/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/docs/_next/static/chunks/130071cec1814339.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"suppressHydrationWarning\":true,\"lang\":\"en\",\"className\":\"inter_1d81deff-module__CYM0aG__variable papermono_89c757f2-module__6aS5zq__variable dark\",\"data-banner-state\":\"visible\",\"data-assistant-state\":\"closed\",\"data-page-mode\":\"none\",\"data-current-path\":\"/\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"dangerouslySetInnerHTML\":{\"__html\":\"!function(){var b=\\\"/docs\\\";\\nfunction a(p){if(p==null)return\\\"/\\\";p=\\\"\\\"+p;if(\\\"\\\"===p)return\\\"/\\\";return\\\"/\\\"===p.charAt(0)?p:\\\"/\\\"+p}\\nfunction u(p){if(p==null)return p;p=\\\"\\\"+p;if(!p||p.charAt(p.length-1)===\\\"/\\\")return p.slice(0,-1);return p}\\nfunction i(p){if(p==null)return p;p=\\\"\\\"+p;if(6\u003c=p.length\u0026\u0026p.substring(p.length-6)===\\\"/index\\\")return p.substring(0,p.length-6);if(\\\"index\\\"===p)return\\\"\\\";return p}\\nvar p=(location.pathname||\\\"\\\").split(\\\"?\\\")[0].split(\\\"#\\\")[0]||\\\"\\\";\\nif(b)if(p===b)p=\\\"\\\";else if(0===p.indexOf(b+\\\"/\\\"))p=p.substring(b.length);\\np=a(p);p=u(p);p=i(p);p=\\\"\\\"===p||\\\"index\\\"===p?\\\"/\\\":a(p);\\ndocument.documentElement.setAttribute(\\\"data-current-path\\\",p);\\n}();\"}}],[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"dangerouslySetInnerHTML\":{\"__html\":\"!function(){\\nfunction read(){try{\\nvar e=performance.getEntriesByType?performance.getEntriesByType(\\\"navigation\\\"):[];\\nvar st=(e[0]\u0026\u0026e[0].serverTiming)||[];\\nvar g={};\\nfor(var i=0;i\u003cst.length;i++){var n=st[i].name,d=st[i].description;if(!d)continue;try{d=decodeURIComponent(d)}catch(x){}\\nif(n===\\\"country\\\")g.country=d;else if(n===\\\"region\\\")g.region=d;else if(n===\\\"continent\\\")g.continent=d;}\\nvar w=window;w.mintlify=w.mintlify||{};w.mintlify.geo=g;\\n}catch(x){}}\\nread();document.addEventListener(\\\"DOMContentLoaded\\\",read);\\n}();\"}}],[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"dangerouslySetInnerHTML\":{\"__html\":\"!function(){try{\\nvar w=window;w.mintlify=w.mintlify||{};\\nvar q=w.mintlify.__apiPlaygroundInputsQueue;\\nif(!Array.isArray(q)){q=[];w.mintlify.__apiPlaygroundInputsQueue=q;}\\nw.mintlify.api=w.mintlify.api||{};\\nw.mintlify.api.playground=w.mintlify.api.playground||{};\\nif(typeof w.mintlify.api.playground.setServerVariables!==\\\"function\\\"){\\nw.mintlify.api.playground.setServerVariables=function(v){q.push({type:\\\"set\\\",variables:v});};\\n}\\nif(typeof w.mintlify.api.playground.clearServerVariables!==\\\"function\\\"){\\nw.mintlify.api.playground.clearServerVariables=function(){q.push({type:\\\"clear\\\"});};\\n}\\n}catch(e){}}();\"}}],[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"dangerouslySetInnerHTML\":{\"__html\":\"(function(a,b){try{let c=document.getElementById(\\\"banner\\\")?.innerText;if(c){for(let d=0;d\u003clocalStorage.length;d++){let e=localStorage.key(d);if(e?.endsWith(a)\u0026\u0026localStorage.getItem(e)===c)return void document.documentElement.setAttribute(b,\\\"hidden\\\")}document.documentElement.setAttribute(b,\\\"visible\\\");return}for(let c=0;c\u003clocalStorage.length;c++){let d=localStorage.key(c);if(d?.endsWith(a)\u0026\u0026localStorage.getItem(d))return void document.documentElement.setAttribute(b,\\\"hidden\\\")}document.documentElement.setAttribute(b,\\\"visible\\\")}catch(a){document.documentElement.setAttribute(b,\\\"hidden\\\")}})(\\n  \\\"bannerDismissed\\\",\\n  \\\"data-banner-state\\\",\\n)\"}}],false]}],\"$L2\"]}]]}],{\"children\":[\"%5Fsites\",\"$L3\",{\"children\":[[\"subdomain\",\"openrouter-d02e98a0\",\"d\"],\"$L4\",{\"children\":[\"(multitenant)\",\"$L5\",{\"children\":[[\"slug\",\"guides/features/tool-calling\",\"oc\"],\"$L6\",{\"children\":[\"__PAGE__\",\"$L7\",{},null,false]},null,false]},null,false]},null,false]},null,false]},null,false],\"$L8\",false]],\"m\":\"$undefined\",\"G\":[\"$9\",[\"$La\",\"$Lb\"]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"c:I[667786,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"MintlifyApiPlaygroundInputsInit\"]\nd:I[339756,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\ne:I[556357,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/27af74e29bec69c2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\nf:I[837457,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"10:I[894587,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ThemeProvider\"]\n"])</script><script>self.__next_f.push([1,"11:I[152823,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ColorVariables\"]\n"])</script><script>self.__next_f.push([1,"12:I[531961,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"FontScript\"]\n"])</script><script>self.__next_f.push([1,"13:I[649328,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"RoundedVariables\"]\n"])</script><script>self.__next_f.push([1,"14:I[702910,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e168288d4907c254.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"RecommendedPagesList\"]\n15:I[570420,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"DataCurrentPathUpdater\"]\n16:I[341175,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/6b1866b1722b1057.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n19:I[897367,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"OutletBoundary\"]\n1b:I[711533,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"AsyncMetadataOutlet\"]\n1d:I[897367,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyM"])</script><script>self.__next_f.push([1,"jrsgK\"],\"ViewportBoundary\"]\n1f:I[897367,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"MetadataBoundary\"]\n20:\"$Sreact.suspense\"\n"])</script><script>self.__next_f.push([1,"2:[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"$Lc\",null,{}],false,[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$e\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-1\",{\"src\":\"/docs/_next/static/chunks/27af74e29bec69c2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-2\",{\"src\":\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-3\",{\"src\":\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-4\",{\"src\":\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}]],\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L10\",null,{\"children\":[[\"$\",\"$L11\",null,{}],[\"$\",\"$L12\",null,{}],[\"$\",\"$L13\",null,{}],[\"$\",\"style\",null,{\"children\":\":root {\\n  --primary: 17 120 102;\\n  --primary-light: 74 222 128;\\n  --primary-dark: 22 101 52;\\n  --background-light: 255 255 255;\\n  --background-dark: 15 17 23;\\n}\"}],[\"$\",\"main\",null,{\"className\":\"h-screen bg-background-light dark:bg-background-dark text-left\",\"children\":[\"$\",\"article\",null,{\"className\":\"bg-custom bg-fixed bg-center bg-cover relative flex flex-col items-center justify-center h-full\",\"children\":[\"$\",\"div\",null,{\"className\":\"w-full max-w-xl px-10\",\"children\":[[\"$\",\"span\",null,{\"className\":\"inline-flex mb-6 rounded-full px-3 py-1 text-sm font-semibold mr-4 text-white p-1 bg-primary\",\"children\":[\"Error \",404]}],[\"$\",\"h1\",null,{\"className\":\"font-semibold mb-3 text-3xl\",\"children\":\"Page not found!\"}],[\"$\",\"p\",null,{\"className\":\"text-lg text-gray-600 dark:text-gray-400 mb-6\",\"children\":\"We couldn't find the page.\"}],[\"$\",\"$L14\",null,{}]]}]}]}]]}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],false,[\"$\",\"$L15\",null,{}]]}]\n"])</script><script>self.__next_f.push([1,"3:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script><script>self.__next_f.push([1,"4:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$16\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-1\",{\"src\":\"/docs/_next/static/chunks/6b1866b1722b1057.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-2\",{\"src\":\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-3\",{\"src\":\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}],[\"$\",\"script\",\"script-4\",{\"src\":\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true}]],\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L10\",null,{\"children\":[[\"$\",\"$L11\",null,{}],[\"$\",\"$L12\",null,{}],[\"$\",\"$L13\",null,{}],[\"$\",\"style\",null,{\"children\":\":root {\\n  --primary: 17 120 102;\\n  --primary-light: 74 222 128;\\n  --primary-dark: 22 101 52;\\n  --background-light: 255 255 255;\\n  --background-dark: 15 17 23;\\n}\"}],[\"$\",\"main\",null,{\"className\":\"h-screen bg-background-light dark:bg-background-dark text-left\",\"children\":[\"$\",\"article\",null,{\"className\":\"bg-custom bg-fixed bg-center bg-cover relative flex flex-col items-center justify-center h-full\",\"children\":[\"$\",\"div\",null,{\"className\":\"w-full max-w-xl px-10\",\"children\":[[\"$\",\"span\",null,{\"className\":\"inline-flex mb-6 rounded-full px-3 py-1 text-sm font-semibold mr-4 text-white p-1 bg-primary\",\"children\":[\"Error \",404]}],[\"$\",\"h1\",null,{\"className\":\"font-semibold mb-3 text-3xl\",\"children\":\"Page not found!\"}],[\"$\",\"p\",null,{\"className\":\"text-lg text-gray-600 dark:text-gray-400 mb-6\",\"children\":\"We couldn't find the page.\"}],[\"$\",\"$L14\",null,{}]]}]}]}]]}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script><script>self.__next_f.push([1,"5:[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"script\",\"script-0\",{\"src\":\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-4\",{\"src\":\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-5\",{\"src\":\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-6\",{\"src\":\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-7\",{\"src\":\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-8\",{\"src\":\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-9\",{\"src\":\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-10\",{\"src\":\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-11\",{\"src\":\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-12\",{\"src\":\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-13\",{\"src\":\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}]],\"$L17\"]}]\n"])</script><script>self.__next_f.push([1,"6:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script><script>self.__next_f.push([1,"7:[\"$\",\"$1\",\"c\",{\"children\":[\"$L18\",[[\"$\",\"script\",\"script-0\",{\"src\":\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-4\",{\"src\":\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-5\",{\"src\":\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-6\",{\"src\":\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-7\",{\"src\":\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L19\",null,{\"children\":[\"$L1a\",[\"$\",\"$L1b\",null,{\"promise\":\"$@1c\"}]]}]]}]\n"])</script><script>self.__next_f.push([1,"8:[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$L1d\",null,{\"children\":\"$L1e\"}],null],[\"$\",\"$L1f\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$20\",null,{\"fallback\":null,\"children\":\"$L21\"}]}]}]]}]\na:[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/docs/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\nb:[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/docs/_next/static/chunks/130071cec1814339.css?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\n"])</script><script>self.__next_f.push([1,"1e:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, viewport-fit=cover\"}]]\n1a:null\n"])</script><script>self.__next_f.push([1,"22:I[707934,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"WebMcpRegistration\"]\n"])</script><script>self.__next_f.push([1,"23:I[590280,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"LivePreviewProvider\"]\n"])</script><script>self.__next_f.push([1,"24:I[973254,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"LivePreviewFavicon\"]\n"])</script><script>self.__next_f.push([1,"25:I[479520,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"\"]\n"])</script><script>self.__next_f.push([1,"26:I[197336,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"27:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"AuthProvider\"]\n"])</script><script>self.__next_f.push([1,"28:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"DeploymentMetadataProvider\"]\n"])</script><script>self.__next_f.push([1,"29:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"DocsConfigProvider\"]\n"])</script><script>self.__next_f.push([1,"17:[null,[\"$\",\"$L22\",null,{\"subdomain\":\"openrouter-d02e98a0\"}],[\"$\",\"$L23\",null,{\"isLivePreviewRoute\":false,\"children\":[[\"$\",\"$L24\",null,{}],[\"$\",\"$L10\",null,{\"appearance\":{\"default\":\"dark\"},\"codeblockTheme\":\"system\",\"children\":[[\"$\",\"blockquote\",null,{\"className\":\"sr-only\",\"data-agent-docs-index\":true,\"aria-hidden\":\"true\",\"children\":[[\"$\",\"h2\",null,{\"children\":\"Documentation Index\"}],[\"$\",\"p\",null,{\"children\":[\"Fetch the complete documentation index at:\",\" \",[\"$\",\"a\",null,{\"href\":\"/docs/llms.txt\",\"tabIndex\":-1,\"children\":\"/docs/llms.txt\"}]]}],[\"$\",\"p\",null,{\"children\":\"Use this file to discover all available pages before exploring further.\"}]]}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root{--banner-height:0px!important}\"}}],false,null,null,[\"$\",\"$L25\",null,{\"id\":\"_mintlify-banner-script\",\"strategy\":\"beforeInteractive\",\"dangerouslySetInnerHTML\":{\"__html\":\"(function j(a,b,c,d,e){try{let f,g,h=[];try{h=window.location.pathname.split(\\\"/\\\").filter(a=\u003e\\\"\\\"!==a\u0026\u0026\\\"global\\\"!==a).slice(0,2)}catch{h=[]}let i=h.find(a=\u003ec.includes(a)),j=[];for(let c of(i?j.push(i):j.push(b),j.push(\\\"global\\\"),j)){if(!c)continue;let b=a[c];if(b?.content){f=b.content,g=c;break}}if(!f)return void document.documentElement.setAttribute(d,\\\"hidden\\\");let k=!0,l=0;for(;l\u003clocalStorage.length;){let a=localStorage.key(l);if(l++,!a?.endsWith(e))continue;let b=localStorage.getItem(a);if(b\u0026\u0026b===f){k=!1;break}g\u0026\u0026(a.startsWith(`lang:${g}_`)||!a.startsWith(\\\"lang:\\\"))\u0026\u0026(localStorage.removeItem(a),l--)}document.documentElement.setAttribute(d,k?\\\"visible\\\":\\\"hidden\\\")}catch(a){console.error(a),document.documentElement.setAttribute(d,\\\"hidden\\\")}})(\\n  {},\\n  \\\"en\\\",\\n  [],\\n  \\\"data-banner-state\\\",\\n  \\\"bannerDismissed\\\",\\n)\"}}],[\"$\",\"$L26\",null,{\"appId\":\"$undefined\",\"autoBoot\":true,\"children\":[\"$\",\"$L27\",null,{\"value\":{\"auth\":\"$undefined\",\"userAuth\":\"$undefined\"},\"children\":[\"$\",\"$L28\",null,{\"value\":{\"subdomain\":\"openrouter-d02e98a0\",\"actualSubdomain\":\"openrouter-d02e98a0\",\"gitSource\":{\"type\":\"github\",\"owner\":\"openrouterteam\",\"repo\":\"docs\",\"deployBranch\":\"main\",\"contentDirectory\":\"\",\"isPrivate\":false,\"mountPath\":\"\",\"label\":\"\"},\"chroma\":{\"collectionId\":\"a17f8b9e-68f0-4fac-856d-68231244e4e4\",\"liveDeploymentHistoryId\":\"6a875d9c1fbed0910bb6b764\",\"schemaVersion\":\"v3\",\"latestBuiltDeploymentHistoryId\":\"6a875d9c1fbed0910bb6b764\"},\"feedback\":{\"contextualFeedback\":{\"allowEmail\":false},\"agentFeedback\":true,\"issues\":false},\"entitlements\":{\"AI_CHAT\":{\"status\":\"ENABLED\"},\"REMOVE_BRANDING\":{\"status\":\"ENABLED\"},\"CONTEXTUAL_FEEDBACK\":{\"status\":\"ENABLED\"},\"CODE_SNIPPET_FEEDBACK\":{\"status\":\"ENABLED\"}},\"buildId\":\"6a8799a5798e682b30d8e238\",\"clientVersion\":\"0.0.3482\",\"preview\":\"$undefined\",\"searchFilterCounts\":[{\"language\":\"default\",\"tag\":\"API Reference\",\"count\":216},{\"language\":\"default\",\"tag\":\"Docs\",\"count\":121},{\"language\":\"default\",\"tag\":\"Client SDKs\",\"count\":90},{\"language\":\"default\",\"tag\":\"Features\",\"count\":56},{\"language\":\"default\",\"tag\":\"TypeScript SDK\",\"count\":46},{\"language\":\"default\",\"tag\":\"Cookbook\",\"count\":46},{\"language\":\"default\",\"tag\":\"Agent SDK\",\"count\":39},{\"language\":\"default\",\"tag\":\"Go SDK\",\"count\":29},{\"language\":\"default\",\"tag\":\"Python SDK\",\"count\":29},{\"language\":\"default\",\"tag\":\"Overview\",\"count\":20}],\"searchSettings\":\"$undefined\",\"disableKonamiCode\":\"$undefined\"},\"children\":[\"$\",\"$L29\",null,{\"value\":{\"docsConfig\":{\"theme\":\"mint\",\"$schema\":\"https://mintlify.com/docs.json\",\"name\":\"OpenRouter | Documentation\",\"colors\":{\"primary\":\"#7624F4\",\"light\":\"#7624F4\",\"dark\":\"#C8FF00\"},\"logo\":{\"light\":\"https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-light.svg?fit=max\u0026auto=format\u0026n=ksNSeB_K7gD-BUDh\u0026q=85\u0026s=690e45873843519efe02bcbe45795dac\",\"dark\":\"https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-dark.svg?fit=max\u0026auto=format\u0026n=ksNSeB_K7gD-BUDh\u0026q=85\u0026s=8ba2f49b11cd9839c37dd03c62537ebd\",\"href\":\"https://openrouter.ai\"},\"favicon\":\"https://mintcdn.com/openrouter-d02e98a0/n3IgkjAMQY8SgOLX/assets/favicon-v2.svg?fit=max\u0026auto=format\u0026n=n3IgkjAMQY8SgOLX\u0026q=85\u0026s=f49800815fcadee8a07dcc093051c2de\",\"appearance\":\"$17:2:props:children:1:props:appearance\",\"background\":{\"color\":{\"light\":\"#FCFCFE\",\"dark\":\"#03080A\"}},\"navbar\":{\"links\":[{\"href\":\"https://openrouter.ai/models\",\"label\":\"Models\"},{\"href\":\"https://openrouter.ai/benchmarks\",\"label\":\"Benchmarks\"},{\"href\":\"https://openrouter.ai/chat\",\"label\":\"Chat\"},{\"href\":\"https://openrouter.ai/rankings\",\"label\":\"Rankings\"},{\"href\":\"https://openrouter.ai/apps\",\"label\":\"Apps\"},{\"href\":\"https://openrouter.ai/docs\",\"label\":\"Docs\"}]},\"seo\":{\"metatags\":{\"canonical\":\"https://openrouter.ai/docs\"}},\"fonts\":{\"family\":\"Plus Jakarta Sans\",\"weight\":400},\"integrations\":{\"ga4\":{\"measurementId\":\"G-R8YZRJS2XN\"},\"posthog\":{\"apiKey\":\"phc_7ToS2jDeWBlMu4n2JoNzoA1FnArdKwFMFoHVnAqQ6O1\",\"apiHost\":\"https://us.i.posthog.com\"}},\"contextual\":{\"options\":[\"copy\",\"view\",\"chatgpt\",\"claude\",\"perplexity\"],\"display\":\"header\"},\"styling\":{\"latex\":true,\"codeblocks\":\"system\"},\"navigation\":{\"pages\":[]}},\"docsNavWithMetadata\":\"$undefined\",\"anonymizedNav\":\"$undefined\",\"hasFullNav\":false},\"children\":\"$L2a\"}]}]}]}]]}]]}]]\n"])</script><script>self.__next_f.push([1,"2b:I[604804,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"LoginButtonProvider\"]\n"])</script><script>self.__next_f.push([1,"2c:I[141180,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"SidebarLoginButtonProvider\"]\n"])</script><script>self.__next_f.push([1,"2d:I[343590,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"NavigationContextController\"]\n"])</script><script>self.__next_f.push([1,"2e:I[378486,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"PageListProvider\"]\n"])</script><script>self.__next_f.push([1,"2f:I[742977,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"PrefetchProvider\"]\n"])</script><script>self.__next_f.push([1,"30:I[237978,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"PageModeOverrideProvider\"]\n"])</script><script>self.__next_f.push([1,"31:I[378896,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ConfiguredVariationProvider\"]\n"])</script><script>self.__next_f.push([1,"32:I[557611,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"Fonts\"]\n"])</script><script>self.__next_f.push([1,"33:I[330080,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"BannerProvider\"]\n"])</script><script>self.__next_f.push([1,"34:I[864506,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"NavbarTransitionScript\"]\n"])</script><script>self.__next_f.push([1,"35:T9e0,"])</script><script>self.__next_f.push([1,"(function () {\n  var measure = function(){let a=document.querySelectorAll(\"[id='navbar'], [data-top-chrome]\"),b=0;a.forEach(a=\u003e{let c=a.getBoundingClientRect();c.height\u003e0\u0026\u0026(b=Math.max(b,c.bottom))});let c=0,d=document.getElementById(\"content-container\");if(d){let{overflowY:a}=getComputedStyle(d);(\"auto\"===a||\"scroll\"===a)\u0026\u0026(c=Math.max(0,d.getBoundingClientRect().top))}let e=`${Math.round(Math.max(0,b-c))+40}px`,f=document.documentElement.style;f.getPropertyValue(\"--scroll-mt\")!==e\u0026\u0026f.setProperty(\"--scroll-mt\",e)};\n  (function(a){let b=[],c=0,d=\"undefined\"==typeof ResizeObserver?null:new ResizeObserver(f);function e(){let c=Array.from(document.querySelectorAll(\"[id='navbar'], [data-top-chrome]\"));(c.length!==b.length||c.some((a,c)=\u003ea!==b[c]))\u0026\u0026d\u0026\u0026(d.disconnect(),c.forEach(a=\u003ed.observe(a))),b=c,a()}function f(){c||(c=requestAnimationFrame(()=\u003e{c=0,e()}))}let g=\"[id='navbar'], [data-top-chrome]\";function h(a){let b=a.target;if(b instanceof Element\u0026\u0026b.closest(g))return!0;for(let b of a.addedNodes)if(b instanceof Element\u0026\u0026(b.matches(g)||b.querySelector(g)))return!0;for(let b of a.removedNodes)if(b instanceof Element\u0026\u0026(b.matches(g)||b.querySelector(g)))return!0;return!1}new MutationObserver(a=\u003e{a.some(h)\u0026\u0026f()}).observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener(\"resize\",f),\"loading\"===document.readyState\u0026\u0026document.addEventListener(\"DOMContentLoaded\",e),e()})(measure);\n  (function(a){let b=window.location.hash.slice(1);if(!b)return;function c(){return\"smooth\"===getComputedStyle(document.documentElement).scrollBehavior}function d(c){let d=document.getElementById(b);return!!d\u0026\u0026(a(),d.scrollIntoView(c?{behavior:c}:void 0),!0)}if(\"complete\"===document.readyState)return void d();let e=new MutationObserver(()=\u003e{!c()\u0026\u0026d(\"instant\")\u0026\u0026f()});function f(){e.disconnect(),window.removeEventListener(\"load\",g)}function g(){let a=c();f(),a\u0026\u0026requestAnimationFrame(()=\u003e{d(),function(){let a=[\"wheel\",\"touchstart\",\"keydown\",\"pointerdown\"],c=0,e=window.scrollY,f=setInterval(()=\u003e{c+=1;let a=document.getElementById(b);if(!a||c\u003e=6)return g();let f=Math.abs(window.scrollY-e)\u003e1;if(e=window.scrollY,f)return;let h=parseFloat(getComputedStyle(a).scrollMarginTop)||0;Math.abs(a.getBoundingClientRect().top-h)\u003e4\u0026\u0026d()},350);function g(){clearInterval(f),a.forEach(a=\u003ewindow.removeEventListener(a,g))}a.forEach(a=\u003ewindow.addEventListener(a,g,{passive:!0}))}()})}window.addEventListener(\"load\",g),e.observe(document.documentElement,{childList:!0,subtree:!0}),!c()\u0026\u0026d(\"instant\")\u0026\u0026f()})(measure);\n})();"])</script><script>self.__next_f.push([1,"2a:[\"$\",\"$L2b\",null,{\"children\":[\"$\",\"$L2c\",null,{\"children\":[\"$\",\"$L2d\",null,{\"children\":[\"$\",\"$L2e\",null,{\"pageListDataMap\":{},\"children\":[\"$\",\"$L2f\",null,{\"disabled\":\"$undefined\",\"children\":[\"$\",\"$L30\",null,{\"children\":[\"$\",\"$L31\",null,{\"children\":[[\"$\",\"$L12\",null,{\"fonts\":\"$17:2:props:children:1:props:children:6:props:children:props:children:props:children:props:value:docsConfig:fonts\",\"theme\":\"mint\",\"subdomain\":\"openrouter-d02e98a0\"}],[[\"$\",\"$L11\",null,{\"docsConfig\":\"$17:2:props:children:1:props:children:6:props:children:props:children:props:children:props:value:docsConfig\"}],[[\"$\",\"link\",null,{\"rel\":\"preload\",\"href\":\"https://d4tuoctqmanu0.cloudfront.net/katex.min.css\",\"as\":\"style\"}],[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"children\":\"\\n          (function() {\\n            function loadKatex() {\\n              const link = document.querySelector('link[href=\\\"https://d4tuoctqmanu0.cloudfront.net/katex.min.css\\\"]');\\n              if (link) link.rel = 'stylesheet';\\n            }\\n            if (document.readyState === 'loading') {\\n              document.addEventListener('DOMContentLoaded', loadKatex);\\n            } else {\\n              loadKatex();\\n            }\\n          })();\\n        \"}]],[\"$\",\"$L13\",null,{\"theme\":\"mint\"}],[\"$\",\"$L32\",null,{\"fonts\":\"$17:2:props:children:1:props:children:6:props:children:props:children:props:children:props:value:docsConfig:fonts\",\"children\":[\"$\",\"$L33\",null,{\"bannersByLocale\":{},\"subdomain\":\"openrouter-d02e98a0\",\"children\":[[\"$\",\"$L34\",null,{\"theme\":\"mint\"}],[\"$\",\"$L25\",null,{\"strategy\":\"beforeInteractive\",\"id\":\"_mintlify-scroll-margin-script\",\"dangerouslySetInnerHTML\":{\"__html\":\"$35\"},\"suppressHydrationWarning\":true}],\"$L36\"]}]}]]]}]}]}]}]}]}]}]\n"])</script><script>self.__next_f.push([1,"37:I[540345,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ConsentProvider\"]\n"])</script><script>self.__next_f.push([1,"38:I[529058,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"LocalStorageAndAnalyticsProviders\"]\n"])</script><script>self.__next_f.push([1,"39:I[958547,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"36:[\"$\",\"$L37\",null,{\"privacy\":\"$undefined\",\"children\":[\"$\",\"$L38\",null,{\"subdomain\":\"openrouter-d02e98a0\",\"isAtlas\":false,\"children\":[\"$\",\"$L39\",null,{\"toggles\":[{\"name\":\"tiered-billing\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-profile-v2\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"dashboard-editor-theseus\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"self-serve-sso\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"force-workflows-vercel-harness\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"kill-isr\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"autumn-billing-mar-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"cloudflare-cache-invalidation\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"workflows-vercel-harness\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"gitlab-workflows\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"autopilot-dashboard\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"live-preview-client\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"direct-chroma-search\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"mintlify-credits-autumn-apr-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent_harness_kb\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent-page\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"dashboard-auth-revamp\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"client-credentials-grant\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent_harness_slack_agent\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"workflows-v2\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"assistant-integrations\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"dashboard-comments\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"workflows-in-onboarding\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"viewer-role\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent-panel\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"autumn-enforcement-mar-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"autumn-webhooks-mar-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent-mintlify-slack\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"workflows-onboarding\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-v7-file-tree\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"atlas-vercel-harness\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"onboarding-vercel-harness\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"refresh-token-auth-mcp\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"use-run-task-generate-docs-phase-queue\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"per-tenant-auth\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent-integrations-settings\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"per-tenant-auth-mcp\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"async-editor-publish\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"automations-pr-grouping\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"pause-preview-search-indexing\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"custom-prefix\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"analytics-v7\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"composio-integrations\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"zendesk-integration\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"process-on-consumer\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"workflows-run-detail-page\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"credits-v2-jul-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"call-agent-tool\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"pylon-integration\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"user-flows-analytics\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"queue-git-webhooks-produce\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"slack-agent-chat-sdk\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"org-credit-pool-jul-2026\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"preview-search-indexing\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"pause-universal-search-reconcile\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-version-history\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"snapshot-serving\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-branches-v2-autocommit\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-branches-v2\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"snapshot-serving-live\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false}],\"children\":\"$L3a\"}]}]}]\n"])</script><script>self.__next_f.push([1,"3b:I[604780,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"CaptchaProvider\"]\n"])</script><script>self.__next_f.push([1,"3c:I[601054,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"SearchProvider\"]\n"])</script><script>self.__next_f.push([1,"3d:I[28330,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"SkipToContent\"]\n"])</script><script>self.__next_f.push([1,"3e:I[87732,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"AssistantLayoutWrapper\"]\n"])</script><script>self.__next_f.push([1,"3f:I[118717,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/746594ec3bf27705.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"NotFoundHydrator\"]\n"])</script><script>self.__next_f.push([1,"3a:[\"$\",\"$L3b\",null,{\"enabled\":true,\"isPreview\":false,\"children\":[\"$\",\"$L3c\",null,{\"subdomain\":\"openrouter-d02e98a0\",\"hasChatPermissions\":true,\"isLoggedInCli\":false,\"assistantConfig\":{\"enableAskAiButton\":false,\"enableStarterQuestions\":false,\"enableContextualStarterQuestions\":false,\"enableAskAiSearchBar\":true},\"starterQuestions\":\"$undefined\",\"children\":[[\"$\",\"$L3d\",null,{}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"(function i(a,b,c,d){try{if(window.matchMedia(\\\"(max-width: 1024px)\\\").matches||!d){document.documentElement.style.setProperty(c,\\\"0px\\\"),document.documentElement.setAttribute(\\\"data-assistant-state\\\",\\\"closed\\\"),d||localStorage.setItem(a,\\\"false\\\");return}let e=localStorage.getItem(a);if(null===e){document.documentElement.style.setProperty(c,\\\"0px\\\"),document.documentElement.setAttribute(\\\"data-assistant-state\\\",\\\"closed\\\");return}let f=JSON.parse(e),g=localStorage.getItem(b),h=null!==g?JSON.parse(g):368;document.documentElement.style.setProperty(c,f?h+\\\"px\\\":\\\"0px\\\"),document.documentElement.setAttribute(\\\"data-assistant-state\\\",f?\\\"open\\\":\\\"closed\\\")}catch(a){document.documentElement.style.setProperty(c,\\\"0px\\\"),document.documentElement.setAttribute(\\\"data-assistant-state\\\",\\\"closed\\\")}})(\\n    \\\"chat-assistant-sheet-open\\\",\\n    \\\"chat-assistant-sheet-width\\\",\\n    \\\"--assistant-sheet-width\\\",\\n    true\\n  )\"}}],false,[\"$\",\"$L3e\",null,{\"children\":[[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L3f\",null,{\"source\":\"multitenant\"}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],\"$undefined\"]}]]}]}]\n"])</script><script>self.__next_f.push([1,"43:I[597003,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ScopedNavProvider\"]\n"])</script><script>self.__next_f.push([1,"1c:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Use tools in your prompts\"}],[\"$\",\"meta\",\"2\",{\"name\":\"application-name\",\"content\":\"OpenRouter | Documentation\"}],[\"$\",\"meta\",\"3\",{\"name\":\"generator\",\"content\":\"Mintlify\"}],[\"$\",\"meta\",\"4\",{\"name\":\"msapplication-config\",\"content\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/browserconfig.xml\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"OpenRouter | Documentation\"}],[\"$\",\"meta\",\"6\",{\"name\":\"msapplication-TileColor\",\"content\":\"#7624F4\"}],[\"$\",\"link\",\"7\",{\"rel\":\"canonical\",\"href\":\"https://openrouter.ai/docs/guides/features/tool-calling\"}],[\"$\",\"link\",\"8\",{\"rel\":\"alternate\",\"type\":\"application/xml\",\"href\":\"/docs/sitemap.xml\"}],[\"$\",\"link\",\"9\",{\"rel\":\"alternate\",\"type\":\"text/markdown\",\"href\":\"/docs/guides/features/tool-calling.md\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:title\",\"content\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:description\",\"content\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:url\",\"content\":\"https://openrouter.ai/docs/guides/features/tool-calling\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:site_name\",\"content\":\"OpenRouter Documentation\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image\",\"content\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"16\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"17\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:title\",\"content\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:description\",\"content\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image\",\"content\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"24\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/android-chrome-192x192.png\",\"type\":\"image/png\",\"sizes\":\"192x192\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"25\",{\"rel\":\"apple-touch-icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/apple-touch-icon.png\",\"type\":\"image/png\",\"sizes\":\"180x180\",\"media\":\"$undefined\"}],[\"$\",\"link\",\"26\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon-16x16.png\",\"type\":\"image/png\",\"sizes\":\"16x16\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"27\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon-32x32.png\",\"type\":\"image/png\",\"sizes\":\"32x32\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"28\",{\"rel\":\"shortcut icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"$undefined\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"29\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/android-chrome-192x192.png\",\"type\":\"image/png\",\"sizes\":\"192x192\",\"media\":\"(prefers-color-scheme: dark)\"}],[\"$\",\"link\",\"30\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon-16x16.png\",\"type\":\"image/png\",\"sizes\":\"16x16\",\"media\":\"(prefers-color-scheme: dark)\"}],\"$L40\",\"$L41\",\"$L42\"],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"21:\"$1c:metadata\"\n"])</script><script>self.__next_f.push([1,"18:[\"$\",\"$L43\",null,{\"scopedNav\":{\"global\":null,\"tabs\":[{\"tab\":\"Docs\",\"icon\":\"book\",\"groups\":[{\"group\":\"Overview\",\"icon\":\"compass\",\"pages\":[{\"title\":\"Quickstart\",\"description\":\"Get started with OpenRouter\",\"slug\":\"quickstart\",\"seoTitle\":\"OpenRouter Quickstart Guide | Developer Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Quickstart Guide\",\"og:description\":\"Get started with OpenRouter's unified API for hundreds of AI models. Learn how to integrate using the API directly, the Client SDKs, or the Agent SDK.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=quickstart\u0026title=Quick%20Start\u0026description=Start%20using%20OpenRouter%20API%20in%20minutes%20with%20any%20SDK\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"rocket\",\"href\":\"/quickstart\"},{\"title\":\"Batch API Quickstart\",\"sidebarTitle\":\"Batch\",\"description\":\"Submit and retrieve asynchronous batches of inference requests\",\"slug\":\"batch-quickstart\",\"seoTitle\":\"Batch API Quickstart | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Batch API Quickstart\",\"og:description\":\"Submit multiple inference requests with OpenRouter and retrieve their results asynchronously.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=batch-quickstart\u0026title=Batch%20API%20Quickstart\u0026description=Submit%20and%20retrieve%20asynchronous%20batches%20of%20inference%20requests\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"boxes-stacked\",\"tag\":\"Beta\",\"href\":\"/batch-quickstart\"},{\"title\":\"Principles\",\"description\":\"Core principles and values of OpenRouter\",\"seoTitle\":\"Principles | OpenRouter's Core Values and Mission\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Principles - OpenRouter's Core Values\",\"og:description\":\"Learn about OpenRouter's guiding principles and mission. Understand our commitment to price optimization, standardized APIs, and high availability in AI model deployment.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=principles\u0026title=Core%20Values\u0026description=Multi-model%20AI%20access%20with%20optimized%20pricing%20and%20reliability\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"book\",\"href\":\"/guides/overview/principles\"},{\"title\":\"Models\",\"description\":\"One API for hundreds of models\",\"seoTitle\":\"OpenRouter Models | Access 400+ AI Models Through One API\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Models - Unified Access to 400+ AI Models\",\"og:description\":\"Access all major language models (LLMs) through OpenRouter's unified API. Browse available models, compare capabilities, and integrate with your preferred provider.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=models\u0026title=AI%20Model%20Hub\u0026description=Access%20all%20LLMs%20through%20one%20unified%20API%20endpoint\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"cube\",\"href\":\"/guides/overview/models\"},{\"title\":\"MCP\",\"description\":\"Connect your AI coding tools to OpenRouter over MCP\",\"seoTitle\":\"OpenRouter MCP Server | OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter MCP Server - OpenRouter\",\"og:description\":\"Plug OpenRouter into the AI tools you already use. Pull live model, pricing, credit, and ranking data, search the docs, and send test messages, all from your editor.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20MCP%20Server\u0026description=Connect%20your%20AI%20tools%20to%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"plug\",\"href\":\"/guides/overview/mcp-server\"},{\"group\":\"Multimodal\",\"icon\":\"layer-group\",\"pages\":[{\"title\":\"Multimodal Capabilities\",\"description\":\"Send images, PDFs, audio, and video to OpenRouter models, generate speech from text, or transcribe audio to text\",\"seoTitle\":\"OpenRouter Multimodal | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Multimodal Capabilities - Complete Documentation\",\"og:description\":\"Send images, PDFs, audio, and video to OpenRouter models, generate speech from text, or transcribe audio to text through our unified API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Multimodal\u0026description=Send%20images%2C%20PDFs%2C%20audio%2C%20and%20video%20to%20OpenRouter%20models%2C%20or%20generate%20speech%20from%20text.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"compass\",\"sidebarTitle\":\"Overview\",\"href\":\"/guides/overview/multimodal/overview\"},{\"title\":\"Image Generation\",\"description\":\"How to generate images with OpenRouter's dedicated Image API\",\"seoTitle\":\"OpenRouter Image Generation | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Image Generation - Complete Documentation\",\"og:description\":\"Generate images using AI models through the OpenRouter Image API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Image%20Generation\u0026description=Generate%20images%20using%20AI%20models%20through%20the%20OpenRouter%20Image%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"wand-magic-sparkles\",\"href\":\"/guides/overview/multimodal/image-generation\"},{\"title\":\"Video Generation\",\"description\":\"How to generate videos with OpenRouter models\",\"seoTitle\":\"OpenRouter Video Generation | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Video Generation - Complete Documentation\",\"og:description\":\"Generate videos using AI models through the OpenRouter API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Video%20Generation\u0026description=Generate%20videos%20using%20AI%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"film\",\"href\":\"/guides/overview/multimodal/video-generation\"},{\"title\":\"Text-to-Speech\",\"description\":\"How to generate speech audio from text with OpenRouter models\",\"seoTitle\":\"OpenRouter Text-to-Speech (TTS) | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Text-to-Speech - Complete Documentation\",\"og:description\":\"Generate speech audio from text using AI models through the OpenRouter API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Text-to-Speech\u0026description=Generate%20speech%20audio%20from%20text%20using%20AI%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"microphone\",\"href\":\"/guides/overview/multimodal/tts\"},{\"title\":\"Speech-to-Text\",\"description\":\"How to transcribe audio into text with OpenRouter models\",\"seoTitle\":\"OpenRouter Speech-to-Text (STT) | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Speech-to-Text - Complete Documentation\",\"og:description\":\"Transcribe audio into text using AI models through the OpenRouter API. Access multiple STT providers with a single unified interface.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Speech-to-Text\u0026description=Transcribe%20audio%20into%20text%20using%20AI%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"headset\",\"href\":\"/guides/overview/multimodal/stt\"},{\"title\":\"Audio\",\"description\":\"How to send and receive audio with OpenRouter models\",\"seoTitle\":\"OpenRouter Audio | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Audio - Complete Documentation\",\"og:description\":\"Send audio files to and receive audio responses from speech-capable models through the OpenRouter API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Audio\u0026description=Send%20and%20receive%20audio%20with%20speech-capable%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"volume-high\",\"href\":\"/guides/overview/multimodal/audio\"},{\"title\":\"PDF Inputs\",\"description\":\"How to send PDFs to OpenRouter models\",\"seoTitle\":\"OpenRouter PDF Inputs | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter PDF Inputs - Complete Documentation\",\"og:description\":\"Send PDF documents to any model on OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20PDF%20Inputs\u0026description=Send%20PDF%20documents%20to%20any%20model%20on%20OpenRouter.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"file-pdf\",\"sidebarTitle\":\"PDFs\",\"href\":\"/guides/overview/multimodal/pdfs\"},{\"title\":\"Image Inputs\",\"description\":\"How to send images to OpenRouter models\",\"seoTitle\":\"OpenRouter Image Inputs | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Image Inputs - Complete Documentation\",\"og:description\":\"Send images to vision models through the OpenRouter API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Image%20Inputs\u0026description=Send%20images%20to%20vision%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"image\",\"sidebarTitle\":\"Image Understanding\",\"href\":\"/guides/overview/multimodal/image-understanding\"},{\"title\":\"Video Inputs\",\"description\":\"How to send video files to OpenRouter models\",\"seoTitle\":\"OpenRouter Video Inputs | Complete Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Video Inputs - Complete Documentation\",\"og:description\":\"Send video files to video-capable models through the OpenRouter API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20Video%20Inputs\u0026description=Send%20video%20files%20to%20video-capable%20models%20through%20the%20OpenRouter%20API.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"video\",\"sidebarTitle\":\"Video Understanding\",\"href\":\"/guides/overview/multimodal/videos\"}]},{\"group\":\"Authentication\",\"icon\":\"shield-check\",\"pages\":[{\"title\":\"OAuth PKCE\",\"description\":\"Connect your users to OpenRouter\",\"seoTitle\":\"OAuth PKCE | Secure Authentication for OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OAuth PKCE - Secure User Authentication\",\"og:description\":\"Implement secure user authentication with OpenRouter using OAuth PKCE. Complete guide to setting up and managing OAuth authentication flows.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=use-cases/oauth-pkce\u0026title=OAuth%20PKCE\u0026description=Secure%20one-click%20authentication%20for%20your%20OpenRouter%20users\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"shield-check\",\"sidebarTitle\":\"OAuth\",\"href\":\"/guides/overview/auth/oauth\"},{\"title\":\"Management API Keys\",\"description\":\"Manage API keys programmatically\",\"seoTitle\":\"Management API Keys | Programmatic Control of OpenRouter API Keys\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Management API Keys - Programmatic Control of OpenRouter API Keys\",\"og:description\":\"Manage OpenRouter API keys programmatically through dedicated management endpoints. Create, read, update, and delete API keys for automated key distribution and control.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=features/management-api-keys\u0026title=Management%20API%20Keys\u0026description=Programmatically%20manage%20OpenRouter%20API%20keys\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"key\",\"href\":\"/guides/overview/auth/management-api-keys\"},{\"title\":\"BYOK\",\"description\":\"Bring your own provider API keys\",\"seoTitle\":\"BYOK | Use Your Own Provider Keys with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"BYOK - Bring Your Own Keys to OpenRouter\",\"og:description\":\"Learn how to use your existing AI provider keys with OpenRouter. Integrate your own API keys while using OpenRouter's unified interface and features.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=BYOK\u0026description=Bring%20Your%20Own%20Keys%20to%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"key\",\"href\":\"/guides/overview/auth/byok\"}]},{\"title\":\"Stripe Projects\",\"description\":\"Add OpenRouter to your app with the Stripe Projects CLI\",\"seoTitle\":\"Stripe Projects Integration | OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Stripe Projects - Add OpenRouter via Stripe CLI\",\"og:description\":\"Provision OpenRouter API access directly from the Stripe Projects CLI. Get an API key, manage credentials, and access 400+ AI models in seconds.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Stripe%20Projects\u0026description=Add%20OpenRouter%20to%20your%20app%20via%20Stripe%20CLI\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"stripe\",\"href\":\"/guides/overview/stripe-projects\"},{\"title\":\"Frequently Asked Questions\",\"description\":\"Common questions about OpenRouter\",\"slug\":\"faq\",\"seoTitle\":\"OpenRouter FAQ | Developer Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter FAQ\",\"og:description\":\"Find answers to commonly asked questions about OpenRouter's unified API, model access, pricing, and integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=faq\u0026title=FAQ\u0026description=Common%20questions%20about%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"question\",\"sidebarTitle\":\"FAQ\",\"href\":\"/faq\"},{\"title\":\"Report Feedback\",\"seoTitle\":\"Report Feedback | Submit Bug Reports on OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Report Feedback - Submit Bug Reports for Generations\",\"og:description\":\"Learn how to report issues with AI generations on OpenRouter using the Report Feedback feature in the Chatroom and Logs page.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Report%20Feedback\u0026description=Submit%20bug%20reports%20for%20generations\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"bug\",\"description\":null,\"href\":\"/guides/overview/report-feedback\"}]},{\"group\":\"Models \u0026 Routing\",\"icon\":\"route\",\"pages\":[{\"title\":\"Model Fallbacks\",\"description\":\"Automatic failover between models\",\"seoTitle\":\"Model Fallbacks | Reliable AI with Automatic Failover\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Model Fallbacks - Automatic Failover Between Models\",\"og:description\":\"Configure automatic failover between AI models when providers are down, rate-limited, or refuse requests.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Model%20Fallbacks\u0026description=Automatic%20failover%20between%20AI%20models\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"arrows-rotate\",\"href\":\"/guides/routing/model-fallbacks\"},{\"title\":\"Provider Routing\",\"description\":\"Route requests to the best provider\",\"seoTitle\":\"Provider Routing | Intelligent Multi-Provider Request Routing\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Provider Routing - Smart Multi-Provider Request Management\",\"og:description\":\"Route AI model requests across multiple providers intelligently. Learn how to optimize for cost, performance, and reliability with OpenRouter's provider routing.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=features/provider-routing\u0026title=Smart%20Routing\u0026description=Optimize%20AI%20requests%20across%20providers%20for%20best%20performance\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"network-wired\",\"sidebarTitle\":\"Provider Selection\",\"href\":\"/guides/routing/provider-selection\"},{\"title\":\"Auto Exacto\",\"description\":\"Automatic tool-calling provider optimization\",\"seoTitle\":\"Auto Exacto | Smarter provider routing for tool-calling requests\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Auto Exacto - Automatic tool-calling provider optimization\",\"og:description\":\"Learn how Auto Exacto automatically optimizes provider ordering for tool-calling requests using throughput, success rate, and benchmark signals.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Auto%20Exacto\u0026description=Automatic%20tool-calling%20provider%20optimization\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"crosshairs\",\"href\":\"/guides/routing/auto-exacto\"},{\"title\":\"Private Models\",\"description\":\"Bring your own model to OpenRouter, scoped to approved users and organizations\",\"seoTitle\":\"Private Models | Private Endpoints on OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Private Models - Bring Your Own Model Endpoints to OpenRouter\",\"og:description\":\"Run your own custom, fine-tuned, or dedicated model deployments through the OpenRouter API. Private models are scoped to approved users and organizations and hidden from public model lists.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Private%20Models\u0026description=Bring%20your%20own%20model%20endpoints%20to%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"lock\",\"href\":\"/guides/routing/private-models\"},{\"group\":\"Model Variants\",\"icon\":\"gem\",\"pages\":[{\"title\":\"Free Variant\",\"description\":\"Access free models with the :free variant\",\"seoTitle\":\"Free Variant | Free Model Access\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Free Variant - Free Model Access\",\"og:description\":\"Access free models using the :free variant suffix.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Free%20Variant\u0026description=Free%20model%20access\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"circle-dollar\",\"sidebarTitle\":\"Free\",\"href\":\"/guides/routing/model-variants/free\"},{\"title\":\"Extended Variant\",\"description\":\"Extended context windows with :extended\",\"seoTitle\":\"Extended Variant | Extended Context Windows\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Extended Variant - Extended Context Windows\",\"og:description\":\"Access extended context window versions of models using the :extended variant.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Extended%20Variant\u0026description=Extended%20context%20windows\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"arrows-left-right\",\"sidebarTitle\":\"Extended\",\"href\":\"/guides/routing/model-variants/extended\"},{\"title\":\"Exacto Variant\",\"description\":\"Route requests with quality-first provider sorting\",\"seoTitle\":\"Exacto Variant | Quality-first provider routing for tool use\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Exacto Variant - Quality-first provider routing for tool use\",\"og:description\":\"Learn how to use the :exacto model variant to prioritize providers with stronger tool-calling quality signals.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Exacto%20Variant\u0026description=Quality-first%20provider%20routing\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"gem\",\"sidebarTitle\":\"Exacto\",\"href\":\"/guides/routing/model-variants/exacto\"},{\"title\":\"Thinking Variant\",\"description\":\"Enable extended reasoning with :thinking\",\"seoTitle\":\"Thinking Variant | Extended Reasoning\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Thinking Variant - Extended Reasoning\",\"og:description\":\"Enable extended reasoning capabilities using the :thinking variant.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Thinking%20Variant\u0026description=Extended%20reasoning\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"brain\",\"sidebarTitle\":\"Thinking\",\"href\":\"/guides/routing/model-variants/thinking\"},{\"title\":\"Online Variant\",\"description\":\"Real-time web search with :online\",\"seoTitle\":\"Online Variant | Real-Time Web Search\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Online Variant - Real-Time Web Search\",\"og:description\":\"Enable real-time web search capabilities using the :online variant.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Online%20Variant\u0026description=Real-time%20web%20search\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"globe-pointer\",\"sidebarTitle\":\"Online\",\"href\":\"/guides/routing/model-variants/online\"},{\"title\":\"Nitro Variant\",\"description\":\"High-speed model inference with :nitro\",\"seoTitle\":\"Nitro Variant | High-Speed Inference\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Nitro Variant - High-Speed Inference\",\"og:description\":\"Access high-speed model inference using the :nitro variant.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Nitro%20Variant\u0026description=High-speed%20inference\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"bolt\",\"sidebarTitle\":\"Nitro\",\"href\":\"/guides/routing/model-variants/nitro\"},{\"title\":\"Floor Variant\",\"description\":\"Lowest-cost model inference with :floor\",\"seoTitle\":\"Floor Variant | Lowest-Cost Inference\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Floor Variant - Lowest-Cost Inference\",\"og:description\":\"Access the cheapest available inference using the :floor variant.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Floor%20Variant\u0026description=Lowest-cost%20inference\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"arrow-down-to-line\",\"sidebarTitle\":\"Floor\",\"href\":\"/guides/routing/model-variants/floor\"}]},{\"group\":\"Routers\",\"icon\":\"robot\",\"pages\":[{\"title\":\"Auto Router\",\"description\":\"Automatically select the best model for your prompt\",\"seoTitle\":\"Auto Router | Smart AI Model Selection\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Auto Router - Intelligent Model Selection\",\"og:description\":\"Automatically select the best AI model for your prompts using OpenRouter's Auto Router, powered by the wisdom of the market.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Auto%20Router\u0026description=Intelligent%20AI%20model%20selection\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"wand-magic-sparkles\",\"href\":\"/guides/routing/routers/auto-router\"},{\"title\":\"Body Builder\",\"description\":\"Generate multiple parallel API requests from natural language\",\"seoTitle\":\"Body Builder | Multi-Model Request Generation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Body Builder - Generate Parallel API Requests\",\"og:description\":\"Use natural language to generate multiple OpenRouter API requests for parallel model execution.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Body%20Builder\u0026description=Multi-model%20request%20generation\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"hammer\",\"href\":\"/guides/routing/routers/body-builder\"},{\"title\":\"Free Models Router\",\"description\":\"Get free AI inference by routing to available free models\",\"seoTitle\":\"Free Models Router | Zero-Cost AI Inference\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Free Models Router - Zero-Cost AI Inference\",\"og:description\":\"Route requests to free AI models automatically using OpenRouter's Free Models Router.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Free%20Models%20Router\u0026description=Zero-cost%20AI%20inference\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"gift\",\"href\":\"/guides/routing/routers/free-router\"},{\"title\":\"Latest Model Resolution\",\"description\":\"Always target the newest version of a model family with a single slug\",\"seoTitle\":\"Latest Model Resolution | Stay on the Freshest Version Automatically\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Latest Model Resolution - Always Target the Newest Version\",\"og:description\":\"Use ~author/family-latest slugs to automatically route to the newest model in a family on OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Latest%20Model%20Resolution\u0026description=Always%20target%20the%20newest%20version\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"clock-rotate-left\",\"href\":\"/guides/routing/routers/latest-resolution\"},{\"title\":\"Pareto Router\",\"description\":\"Pick a coding model by minimum coding score without choosing a specific model\",\"seoTitle\":\"Pareto Router | Coding-Score-Based Model Selection\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Pareto Router - Coding-Score-Based Model Selection\",\"og:description\":\"Route coding requests by a single minimum coding score using OpenRouter's Pareto Router.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Pareto%20Router\u0026description=Coding-score-based%20model%20selection\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"chart-line\",\"href\":\"/guides/routing/routers/pareto-router\"},{\"title\":\"Fusion Router\",\"description\":\"Multi-model deliberation as a model slug\",\"seoTitle\":\"Fusion Router | Multi-model AI Deliberation with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Fusion Router - openrouter/fusion\",\"og:description\":\"Use the openrouter/fusion model slug to access multi-model deliberation (a panel of models, an analyst, and a final answer) in a single API call.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Fusion%20Router\u0026description=Multi-model%20deliberation%20as%20a%20model%20slug\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"circle-nodes\",\"href\":\"/guides/routing/routers/fusion-router\"}]}]},{\"group\":\"Features\",\"icon\":\"stars\",\"pages\":[{\"title\":\"Workspaces\",\"description\":\"Organize your projects, teams, and agents into separate environments\",\"seoTitle\":\"Workspaces | OpenRouter Project \u0026 Team Management\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Workspaces - Organize Projects, Teams, and Agents\",\"og:description\":\"Separate your OpenRouter projects into independent environments, each with its own API keys, routing defaults, guardrails, and observability.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Workspaces\u0026description=Organize%20projects%2C%20teams%2C%20and%20agents\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"grid-2\",\"href\":\"/guides/features/workspaces\"},{\"title\":\"Workspace Budgets\",\"description\":\"Set spending limits per workspace with automatic enforcement\",\"seoTitle\":\"Workspace Budgets | OpenRouter Spend Controls\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Workspace Budgets - Per-Workspace Spend Limits\",\"og:description\":\"Cap workspace spend with daily, weekly, monthly, or lifetime budgets. Requests are blocked automatically when a budget is met.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Workspace%20Budgets\u0026description=Per-workspace%20spend%20limits\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"wallet\",\"href\":\"/guides/features/workspaces/workspace-budgets\"},{\"title\":\"Switching Workspaces\",\"description\":\"Change which workspace your Chat and Fusion requests run in.\",\"seoTitle\":\"Switching Workspaces | OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Switching Workspaces - Change Your Active Workspace\",\"og:description\":\"Switch your active workspace directly from the Chat and Fusion sidebar so cookie-authenticated requests run in the workspace you choose.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Switching%20Workspaces\u0026description=Change%20your%20active%20workspace\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"repeat\",\"href\":\"/guides/features/workspaces/switching\"},{\"title\":\"Single Sign-On (SSO)\",\"description\":\"Let your team sign in to OpenRouter through your identity provider\",\"seoTitle\":\"OpenRouter Single Sign-On (SSO) | Developer Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Single Sign-On (SSO)\",\"og:description\":\"Set up SAML single sign-on for your OpenRouter organization with Okta, Microsoft Entra ID, Google Workspace, or a custom SAML identity provider.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=guides/features/sso\u0026title=Single%20Sign-On\u0026description=Sign%20in%20through%20your%20identity%20provider\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"shield-halved\",\"href\":\"/guides/features/sso\"},{\"title\":\"SCIM Group Mappings\",\"description\":\"Automatically provision workspace access from your identity provider groups\",\"seoTitle\":\"OpenRouter SCIM Group Mappings | Developer Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter SCIM Group Mappings\",\"og:description\":\"Map groups provisioned by your identity provider to OpenRouter workspaces so members are automatically granted the right access.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=guides/features/scim-mappings\u0026title=SCIM%20Group%20Mappings\u0026description=Automatic%20workspace%20provisioning%20from%20your%20IdP\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"users-gear\",\"href\":\"/guides/features/scim-mappings\"},{\"title\":\"Presets\",\"description\":\"Manage your LLM configurations\",\"seoTitle\":\"Presets | Configuration Management for AI Models\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Presets - Configuration Management for AI Models\",\"og:description\":\"Learn how to use OpenRouter's presets to manage model configurations, system prompts, and parameters across your applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Presets\u0026description=Configuration%20management%20for%20AI%20models\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"sliders\",\"href\":\"/guides/features/presets\"},{\"title\":\"Custom Classifiers\",\"description\":\"Automatically categorize LLM generations in your workspace\",\"seoTitle\":\"Custom Classifiers | OpenRouter AI Usage Classification\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Custom Classifiers - Automatic AI Usage Classification\",\"og:description\":\"Define custom taxonomies and automatically classify every LLM generation by department, task type, complexity, or any dimension you choose.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Custom%20Classifiers\u0026description=Automatic%20AI%20usage%20classification\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"tag\",\"href\":\"/guides/features/classifiers\"},{\"title\":\"Response Caching\",\"description\":\"Cache responses for identical API requests to save time and money\",\"seoTitle\":\"Response Caching | Cache API Responses with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Response Caching - Cache Identical API Responses\",\"og:description\":\"Cache identical LLM requests with OpenRouter's response caching feature. Reduce costs and latency for agent workflows, unit testing, and repeated context processing.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Response%20Caching\u0026description=Cache%20responses%20for%20identical%20API%20requests%20to%20save%20time%20and%20money\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"box-archive\",\"href\":\"/guides/features/response-caching\"},{\"title\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"seoTitle\":\"Tool \u0026 Function Calling | Use Tools with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\",\"og:description\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"toolbox\",\"sidebarTitle\":\"Tool Calling\",\"href\":\"/guides/features/tool-calling\"},{\"group\":\"Server Tools\",\"icon\":\"server\",\"pages\":[{\"title\":\"Server Tools\",\"description\":\"Tools operated by OpenRouter that models can call during request\",\"seoTitle\":\"Server Tools | Model-Callable Tools Operated by OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Server Tools - Model-Callable Tools by OpenRouter\",\"og:description\":\"Add powerful server-side tools like web search, web fetch, datetime, and image generation to any model on OpenRouter. Models decide when to call them, and OpenRouter executes them automatically.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Server%20Tools\u0026description=Model-Callable%20Tools%20by%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"compass\",\"sidebarTitle\":\"Overview\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools\"},{\"title\":\"Web Search\",\"description\":\"Give any model access to real-time web information\",\"seoTitle\":\"Web Search Server Tool | Real-Time Web Search for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Web Search Server Tool - Real-Time Web Search for Any Model\",\"og:description\":\"Add real-time web search to any model on OpenRouter. The model decides when to search, OpenRouter executes it, and results are returned with citations.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=features/server-tools/web-search\u0026title=Web%20Search%20Server%20Tool\u0026description=Real-time%20web%20search%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"globe\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/web-search\"},{\"title\":\"Web Fetch\",\"description\":\"Give any model the ability to fetch content from URLs\",\"seoTitle\":\"Web Fetch Server Tool | URL Content Retrieval for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Web Fetch Server Tool - URL Content Retrieval for Any Model\",\"og:description\":\"Add URL content fetching to any model on OpenRouter. The model decides when to fetch, OpenRouter retrieves the content, and results are returned as text.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Web%20Fetch%20Server%20Tool\u0026description=URL%20content%20retrieval%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"link\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/web-fetch\"},{\"title\":\"Datetime\",\"description\":\"Give any model access to the current date and time\",\"seoTitle\":\"Datetime Server Tool | Current Date and Time for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Datetime Server Tool - Current Date and Time for Any Model\",\"og:description\":\"Add current date and time awareness to any model on OpenRouter. The model calls the tool when it needs temporal context.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Datetime%20Server%20Tool\u0026description=Current%20date%20and%20time%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"clock\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/datetime\"},{\"title\":\"Image Generation\",\"description\":\"Generate images from text prompts with any model\",\"seoTitle\":\"Image Generation Server Tool | AI Image Generation for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Image Generation Server Tool - AI Image Generation for Any Model\",\"og:description\":\"Add AI image generation to any model on OpenRouter. The model calls the tool with a prompt, OpenRouter generates the image and returns it.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Image%20Generation%20Server%20Tool\u0026description=AI%20image%20generation%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"image\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/image-generation\"},{\"title\":\"Apply Patch\",\"description\":\"Let models propose file changes via V4A diffs\",\"seoTitle\":\"Apply Patch Server Tool | File Editing for Coding Agents\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Apply Patch Server Tool - File Editing for Coding Agents\",\"og:description\":\"Enable any model on OpenRouter to propose file edits using V4A diff patches. The model generates the patch, OpenRouter validates it, and your application applies it.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=features/server-tools/apply-patch\u0026title=Apply%20Patch%20Server%20Tool\u0026description=File%20editing%20for%20coding%20agents\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"file-code\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/apply-patch\"},{\"title\":\"Bash\",\"hidden\":true,\"description\":\"Give any model a sandboxed shell to run commands server-side\",\"seoTitle\":\"Bash Server Tool | Sandboxed Shell Execution for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Bash Server Tool - Sandboxed Shell Execution for Any Model\",\"og:description\":\"Add a sandboxed shell to any model on OpenRouter. The model decides when to run commands, OpenRouter executes them server-side in an isolated container, and stdout/stderr are returned.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Bash%20Server%20Tool\u0026description=Sandboxed%20shell%20execution%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"href\":\"/guides/features/server-tools/bash\",\"hiddenSetByFrontmatter\":true},{\"title\":\"Shell\",\"description\":\"Give any model a sandboxed hosted shell on the Responses and Messages APIs\",\"seoTitle\":\"Shell Server Tool | Hosted Shell Execution for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Shell Server Tool - Hosted Shell Execution for Any Model\",\"og:description\":\"Add a hosted shell to any model on OpenRouter's Responses and Messages APIs. A sandbox-backed clone of OpenAI's hosted shell tool: the model runs commands server-side in an isolated container.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Shell%20Server%20Tool\u0026description=Hosted%20shell%20execution%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"terminal\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/shell\"},{\"title\":\"Files\",\"hidden\":true,\"description\":\"Let any model read, write, edit, and list workspace files\",\"seoTitle\":\"Files Server Tool | Workspace File Access for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Files Server Tool - Workspace File Access for Any Model\",\"og:description\":\"Give any model on OpenRouter the ability to read, write, edit, and list text files in your workspace via the Files API. The model decides when to operate on files, and OpenRouter executes the operations server-side.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Files%20Server%20Tool\u0026description=Workspace%20file%20access%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"folder-open\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/files\",\"hiddenSetByFrontmatter\":true},{\"title\":\"Search Models\",\"description\":\"Let any model search the OpenRouter model catalog\",\"seoTitle\":\"Search Models Server Tool | Model Discovery for Any Model\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Search Models Server Tool - Model Discovery for Any Model\",\"og:description\":\"Give any model on OpenRouter the ability to search and filter the OpenRouter model catalog by name, modality, context length, and series.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Search%20Models%20Server%20Tool\u0026description=Model%20discovery%20for%20any%20model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"magnifying-glass\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/search-models\"},{\"title\":\"Fusion\",\"description\":\"Multi-model deliberation as a server tool\",\"seoTitle\":\"Fusion Server Tool | Multi-model AI Analysis with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Fusion Server Tool - Multi-model Analysis for Any Model\",\"og:description\":\"Let any model invoke an expert panel and analyst to surface consensus, contradictions, coverage gaps, unique insights, and blind spots.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Fusion%20Server%20Tool\u0026description=Multi-model%20deliberation%20on%20demand\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"circle-nodes\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/fusion\"},{\"title\":\"Advisor\",\"description\":\"Consult a stronger model mid-generation as a server tool\",\"seoTitle\":\"Advisor Server Tool | Mid-generation Model Consultation on OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Advisor Server Tool - Consult a Stronger Model Mid-generation\",\"og:description\":\"Let a fast executor model consult a higher-intelligence advisor model for guidance mid-generation, with any OpenRouter model.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Advisor%20Server%20Tool\u0026description=Consult%20a%20stronger%20model%20on%20demand\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"lightbulb\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/advisor\"},{\"title\":\"Subagent\",\"description\":\"Delegate tasks to a smaller, faster model as a server tool\",\"seoTitle\":\"Subagent Server Tool | Mid-generation Task Delegation on OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Subagent Server Tool - Delegate Tasks to Smaller Models\",\"og:description\":\"Let a large model break work into focused sub-tasks and delegate them to a smaller, cheaper, faster worker model: any OpenRouter model, with optional tools.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Subagent%20Server%20Tool\u0026description=Delegate%20tasks%20to%20smaller%20models\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"sitemap\",\"tag\":\"Beta\",\"href\":\"/guides/features/server-tools/subagent\"}]},{\"group\":\"Plugins\",\"icon\":\"plug\",\"pages\":[{\"title\":\"Plugins\",\"description\":\"Extend model capabilities with OpenRouter plugins\",\"seoTitle\":\"Plugins | Extend AI Model Capabilities\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Plugins - Extend AI Model Capabilities\",\"og:description\":\"Enable powerful plugins like web search, PDF processing, and response healing to extend any model's capabilities on OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Plugins\u0026description=Extend%20AI%20Model%20Capabilities\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"compass\",\"sidebarTitle\":\"Overview\",\"href\":\"/guides/features/plugins\"},{\"title\":\"Web Search\",\"description\":\"Model-agnostic grounding\",\"seoTitle\":\"Web Search | Add Real-time Web Data to AI Model Responses\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Web Search - Real-time Web Grounding for AI Models\",\"og:description\":\"Enable real-time web search capabilities in your AI model responses. Add factual, up-to-date information to any model's output with OpenRouter's web search feature.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=features/web-search\u0026title=Web%20Search\u0026description=Add%20real-time%20web%20data%20to%20any%20AI%20model%20response\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"globe\",\"href\":\"/guides/features/plugins/web-search\"},{\"title\":\"Response Healing\",\"description\":\"Automatically fix malformed JSON responses\",\"seoTitle\":\"Response Healing | Validate and Repair AI Model Responses\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Response Healing - Fix Malformed JSON from AI Models\",\"og:description\":\"Automatically validate and repair malformed JSON responses from AI models. Ensure your responses match your schema even when models return imperfect formatting.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Response%20Healing\u0026description=Validate%20and%20Repair%20AI%20Model%20Responses\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"bandage\",\"href\":\"/guides/features/plugins/response-healing\"},{\"title\":\"Fusion\",\"description\":\"Multi-model analysis with an analyst model\",\"seoTitle\":\"Fusion | Multi-model AI Analysis with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Fusion - Multi-model Analysis on OpenRouter\",\"og:description\":\"Get richer answers by running a panel of models in parallel and comparing their responses through an analyst. Fusion makes this a one-line addition to any OpenRouter request.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Fusion\u0026description=Multi-model%20Analysis%20with%20a%20Analyst%20Model\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"circle-nodes\",\"href\":\"/guides/features/plugins/fusion\"}]},{\"title\":\"Structured Outputs\",\"description\":\"Return structured data from your models\",\"seoTitle\":\"Structured Outputs | Enforce JSON Schema in OpenRouter API Responses\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Structured Outputs - Type-Safe JSON Responses from AI Models\",\"og:description\":\"Enforce JSON Schema validation on AI model responses. Get consistent, type-safe outputs and avoid parsing errors with OpenRouter's structured output feature.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Structured%20Outputs\u0026description=Type-Safe%20JSON%20Responses%20from%20AI%20Models\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"code\",\"href\":\"/guides/features/structured-outputs\"},{\"title\":\"Message Transforms\",\"description\":\"Transform prompt messages\",\"seoTitle\":\"Message Transforms | Pre-process AI Model Inputs with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Message Transforms - Optimize AI Model Inputs\",\"og:description\":\"Transform and optimize messages before sending them to AI models. Learn about middle-out compression and context window optimization with OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Message%20Transforms\u0026description=Optimize%20AI%20model%20inputs%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"arrows-rotate\",\"href\":\"/guides/features/message-transforms\"},{\"title\":\"Zero Completion Insurance\",\"description\":\"OpenRouter will not charge you for zero token responses\",\"seoTitle\":\"Zero Completion Insurance | No Charge for Zero Token Responses\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Zero Completion Insurance - No Charge for Zero Token Responses\",\"og:description\":\"Learn how OpenRouter protects users from being charged for failed or empty AI responses with zero completion insurance.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Zero%20Completion%20Insurance\u0026description=No%20Charge%20for%20Zero%20Token%20Responses\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"shield\",\"href\":\"/guides/features/zero-completion-insurance\"},{\"title\":\"Zero Data Retention\",\"description\":\"How OpenRouter gives you control over your data\",\"seoTitle\":\"Zero Data Retention | How OpenRouter gives you control over your data\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Zero Data Retention - How OpenRouter gives you control over your data\",\"og:description\":\"Learn how OpenRouter gives you control over your data\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Zero%20Data%20Retention\u0026description=How%20OpenRouter%20gives%20you%20control%20over%20your%20data\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"shield-halved\",\"sidebarTitle\":\"ZDR\",\"href\":\"/guides/features/zdr\"},{\"title\":\"App Attribution\",\"description\":\"Get your app featured in OpenRouter rankings and analytics\",\"slug\":\"app-attribution\",\"seoTitle\":\"App Attribution | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"App Attribution\",\"og:description\":\"Learn how to attribute your API usage to your app and appear in OpenRouter's app rankings and model analytics.\",\"og:image\":\"https://openrouter.ai/dynamic-og?pathname=app-attribution\u0026title=App%20Attribution\u0026description=Get%20your%20app%20featured%20in%20rankings\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"chart-line\",\"href\":\"/app-attribution\"},{\"group\":\"Guardrails\",\"icon\":\"shield-check\",\"pages\":[{\"title\":\"Guardrails\",\"description\":\"Control spending and model access for your organization\",\"seoTitle\":\"Guardrails | OpenRouter Organization Controls\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Guardrails - Organization Spending and Access Controls\",\"og:description\":\"Set spending limits, restrict model access, and enforce data policies for your organization members and API keys with OpenRouter guardrails.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Guardrails\u0026description=Control%20spending%20and%20model%20access\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"book-open\",\"sidebarTitle\":\"Overview\",\"href\":\"/guides/features/guardrails\"},{\"group\":\"Prompt Injection Detection\",\"icon\":\"syringe\",\"root\":{\"title\":\"Prompt Injection Detection\",\"description\":\"Regex-based prompt injection guardrail patterns\",\"seoTitle\":\"Prompt Injection Detection | OpenRouter Guardrails\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Prompt Injection Detection - Guardrail Regex Patterns\",\"og:description\":\"Reference documentation for the regex-based prompt injection detection patterns used by OpenRouter guardrails, inspired by the OWASP LLM Prompt Injection Prevention Cheat Sheet.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Prompt%20Injection%20Detection\u0026description=Guardrail%20regex%20patterns\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"icon\":\"syringe\",\"href\":\"/guides/features/guardrails/prompt-injection\"},\"pages\":[{\"title\":\"Allowlist\",\"description\":\"Exclude known-safe phrases from prompt injection detection\",\"seoTitle\":\"Allowlist | OpenRouter Guardrails\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Prompt Injection Allowlist - Exclude Safe Phrases from Detection\",\"og:description\":\"Add specific phrases to an allowlist so they are not flagged, redacted, or blocked by the regex-based prompt injection guardrail.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Prompt%20Injection%20Allowlist\u0026description=Exclude%20safe%20phrases%20from%20detection\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"list-check\",\"href\":\"/guides/features/guardrails/prompt-injection/allowlist\"}]},{\"title\":\"Sensitive Info Guardrail\",\"description\":\"Automatically detect and handle sensitive information in API requests\",\"seoTitle\":\"Sensitive Info Guardrail | OpenRouter Data Protection\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Sensitive Info Guardrail - Automatic PII Detection and Redaction\",\"og:description\":\"Protect sensitive data in your AI requests with OpenRouter Sensitive Info Guardrails. Automatically detect and redact or block PII like emails, phone numbers, names, addresses, and more.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Sensitive%20Info%20Guardrail\u0026description=Automatically%20detect%20and%20handle%20sensitive%20information\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"eye-slash\",\"sidebarTitle\":\"Sensitive Info\",\"href\":\"/guides/features/guardrails/sensitive-info\"}]},{\"title\":\"Service Tiers\",\"description\":\"Control cost and latency tradeoffs with service tier selection\",\"seoTitle\":\"Service Tiers | OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Service Tiers - Control Cost and Latency Tradeoffs\",\"og:description\":\"Learn how to use service tiers on OpenRouter to control cost and latency tradeoffs when routing requests to AI providers.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Service%20Tiers\u0026description=Control%20Cost%20and%20Latency%20Tradeoffs\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"layer-group\",\"href\":\"/guides/features/service-tiers\"},{\"title\":\"Sovereign AI\",\"description\":\"Keep AI workloads within national and regional boundaries\",\"seoTitle\":\"Sovereign AI | In-Region AI Routing with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Sovereign AI - In-Region AI Routing with OpenRouter\",\"og:description\":\"Learn how OpenRouter enables sovereign AI with in-region routing, data residency controls, and compliance features that keep your AI workloads within national and regional boundaries.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Sovereign%20AI\u0026description=In-Region%20AI%20Routing%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"globe\",\"href\":\"/guides/features/sovereign-ai\"},{\"title\":\"Router Metadata\",\"description\":\"Surface routing decisions on every response with a single opt-in header\",\"seoTitle\":\"Router Metadata | OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Router Metadata - Inspect Routing Decisions on Every Response\",\"og:description\":\"Opt in to OpenRouter routing metadata to see which provider was selected, fallback attempts, and pipeline stages applied to your request.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Router%20Metadata\u0026description=Inspect%20Routing%20Decisions%20on%20Every%20Response\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"circle-info\",\"href\":\"/guides/features/router-metadata\"},{\"title\":\"Input \u0026 Output Logging\",\"description\":\"Privately store and review your prompts and completions\",\"seoTitle\":\"Input \u0026 Output Logging | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Input \u0026 Output Logging - Privately Store Prompts and Completions\",\"og:description\":\"Store your prompts and completions privately on OpenRouter for debugging, evaluation, and optimization. View them in your Logs page.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Input%20%26%20Output%20Logging\u0026description=Privately%20store%20and%20review%20prompts\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"file-lines\",\"sidebarTitle\":\"Input \u0026 Output Logging\",\"href\":\"/guides/features/input-output-logging\"},{\"group\":\"Broadcast\",\"icon\":\"broadcast-tower\",\"pages\":[{\"title\":\"Broadcast\",\"description\":\"Send traces to external observability platforms\",\"seoTitle\":\"Broadcast | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast - Send Traces to Observability Platforms\",\"og:description\":\"Connect your LLM observability platforms to automatically receive traces from your OpenRouter requests. Supports Langfuse, Datadog, Braintrust, and more.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Broadcast\u0026description=Send%20traces%20to%20observability%20platforms\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"compass\",\"sidebarTitle\":\"Overview\",\"href\":\"/guides/features/broadcast\"},{\"title\":\"Arize AX\",\"description\":\"Send traces to Arize AX\",\"seoTitle\":\"Broadcast to Arize AX | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Arize AX - Send Traces to Arize AX\",\"og:description\":\"Connect Arize AX to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Arize AX integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Arize%20AX%20Broadcast\u0026description=Send%20traces%20to%20Arize%20AX\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/arize\"},{\"title\":\"Braintrust\",\"description\":\"Send traces to Braintrust\",\"seoTitle\":\"Broadcast to Braintrust | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Braintrust - Send Traces to Braintrust\",\"og:description\":\"Connect Braintrust to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Braintrust integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Braintrust%20Broadcast\u0026description=Send%20traces%20to%20Braintrust\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/braintrust\"},{\"title\":\"ClickHouse\",\"description\":\"Send traces to ClickHouse\",\"seoTitle\":\"Broadcast to ClickHouse | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to ClickHouse - Send Traces to Your Analytics Database\",\"og:description\":\"Connect ClickHouse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for ClickHouse integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=ClickHouse%20Broadcast\u0026description=Send%20traces%20to%20ClickHouse\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/clickhouse\"},{\"title\":\"Comet Opik\",\"description\":\"Send traces to Comet Opik\",\"seoTitle\":\"Broadcast to Comet Opik | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Comet Opik - Send Traces to Opik\",\"og:description\":\"Connect Comet Opik to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Opik integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Comet%20Opik%20Broadcast\u0026description=Send%20traces%20to%20Comet%20Opik\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/opik\"},{\"title\":\"Datadog\",\"description\":\"Send traces to Datadog\",\"seoTitle\":\"Datadog Broadcast | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Datadog Broadcast - Send Traces to Datadog LLM Observability\",\"og:description\":\"Connect Datadog LLM Observability to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Datadog integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Datadog%20Broadcast\u0026description=Send%20traces%20to%20Datadog%20LLM%20Observability\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/datadog\"},{\"title\":\"Google BigQuery\",\"description\":\"Send traces to Google BigQuery\",\"seoTitle\":\"Broadcast to Google BigQuery | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Google BigQuery - Send Traces to Your Data Warehouse\",\"og:description\":\"Connect Google BigQuery to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for BigQuery integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=BigQuery%20Broadcast\u0026description=Send%20traces%20to%20Google%20BigQuery\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/bigquery\"},{\"title\":\"Grafana Cloud\",\"description\":\"Send traces to Grafana Cloud\",\"seoTitle\":\"Broadcast to Grafana Cloud | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Grafana Cloud - Send Traces to Grafana Tempo\",\"og:description\":\"Connect Grafana Cloud to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Grafana Cloud integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Grafana%20Cloud%20Broadcast\u0026description=Send%20traces%20to%20Grafana%20Cloud\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/grafana\"},{\"title\":\"Langfuse\",\"description\":\"Send traces to Langfuse\",\"seoTitle\":\"Broadcast to Langfuse | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Langfuse - Send Traces to Langfuse\",\"og:description\":\"Connect Langfuse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Langfuse integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Langfuse%20Broadcast\u0026description=Send%20traces%20to%20Langfuse\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/langfuse\"},{\"title\":\"LangSmith\",\"description\":\"Send traces to LangSmith\",\"seoTitle\":\"Broadcast to LangSmith | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to LangSmith - Send Traces to LangSmith\",\"og:description\":\"Connect LangSmith to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for LangSmith integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=LangSmith%20Broadcast\u0026description=Send%20traces%20to%20LangSmith\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/langsmith\"},{\"title\":\"New Relic\",\"description\":\"Send traces to New Relic\",\"seoTitle\":\"Broadcast to New Relic | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to New Relic - Send Traces to New Relic\",\"og:description\":\"Connect New Relic to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for New Relic integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=New%20Relic%20Broadcast\u0026description=Send%20traces%20to%20New%20Relic\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/newrelic\"},{\"title\":\"OpenTelemetry Collector\",\"description\":\"Send traces to any OpenTelemetry-compatible backend\",\"seoTitle\":\"Broadcast to OpenTelemetry Collector | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to OpenTelemetry Collector - Send Traces to OTLP Backends\",\"og:description\":\"Connect any OpenTelemetry-compatible backend to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for OTLP integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenTelemetry%20Collector%20Broadcast\u0026description=Send%20traces%20to%20OTLP%20backends\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/otel-collector\"},{\"title\":\"PostHog\",\"description\":\"Send traces to PostHog\",\"seoTitle\":\"Broadcast to PostHog | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to PostHog - Send Traces to PostHog\",\"og:description\":\"Connect PostHog to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for PostHog integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=PostHog%20Broadcast\u0026description=Send%20traces%20to%20PostHog\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/posthog\"},{\"title\":\"Raindrop\",\"description\":\"Send traces to Raindrop\",\"seoTitle\":\"Broadcast to Raindrop | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Raindrop - Send Traces to Raindrop\",\"og:description\":\"Connect Raindrop to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Raindrop integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Raindrop%20Broadcast\u0026description=Send%20traces%20to%20Raindrop\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/raindrop\"},{\"title\":\"Ramp\",\"description\":\"Send traces to Ramp\",\"seoTitle\":\"Broadcast to Ramp | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Ramp - Send Traces to Ramp\",\"og:description\":\"Connect Ramp to automatically receive AI usage traces from your OpenRouter requests. Step-by-step setup guide for Ramp integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Ramp%20Broadcast\u0026description=Send%20traces%20to%20Ramp\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/ramp\"},{\"title\":\"S3 / S3-Compatible\",\"description\":\"Send traces to Amazon S3 or S3-compatible storage\",\"seoTitle\":\"Broadcast to S3 | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to S3 - Send Traces to S3 Storage\",\"og:description\":\"Connect Amazon S3 or S3-compatible storage to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for S3 integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=S3%20Broadcast\u0026description=Send%20traces%20to%20S3%20storage\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/s3\"},{\"title\":\"Sentry\",\"description\":\"Send traces to Sentry\",\"seoTitle\":\"Broadcast to Sentry | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Sentry - Send Traces to Sentry\",\"og:description\":\"Connect Sentry to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Sentry integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Sentry%20Broadcast\u0026description=Send%20traces%20to%20Sentry\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/sentry\"},{\"title\":\"Snowflake\",\"description\":\"Send traces to Snowflake\",\"seoTitle\":\"Broadcast to Snowflake | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Snowflake - Send Traces to Your Data Warehouse\",\"og:description\":\"Connect Snowflake to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Snowflake integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Snowflake%20Broadcast\u0026description=Send%20traces%20to%20Snowflake\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/snowflake\"},{\"title\":\"W\u0026B Weave\",\"description\":\"Send traces to W\u0026B Weave\",\"seoTitle\":\"Broadcast to W\u0026B Weave | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to W\u0026B Weave - Send Traces to W\u0026B Weave\",\"og:description\":\"Connect W\u0026B Weave to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for W\u0026B Weave integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=W%26B%20Weave%20Broadcast\u0026description=Send%20traces%20to%20W%26B%20Weave\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/weave\"},{\"title\":\"Webhook\",\"description\":\"Send traces to any HTTP endpoint\",\"seoTitle\":\"Broadcast to Webhook | OpenRouter Observability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Broadcast to Webhook - Send Traces to Any HTTP Endpoint\",\"og:description\":\"Connect any HTTP endpoint to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Webhook integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Webhook%20Broadcast\u0026description=Send%20traces%20to%20any%20HTTP%20endpoint\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/features/broadcast/webhook\"}]}]},{\"group\":\"Ori\",\"icon\":\"terminal\",\"pages\":[{\"title\":\"Ori Eval\",\"description\":\"Find the best model for your project by testing your agent on real prompts, with one harness and one model for each run\",\"seoTitle\":\"Ori Eval | Find the Best Model for Your Project\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Ori Eval - Find the Best Model for Your Project\",\"og:description\":\"Ask which model is best for your project. Ori finds test data in your repo, writes the eval, runs your candidates, and recommends one, with the scores that support the recommendation.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Ori%20Eval\u0026description=Find%20the%20best%20model%20for%20your%20project\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"nofollow\":false,\"icon\":\"vial-circle-check\",\"href\":\"/guides/ori/eval\"},{\"title\":\"Ori Harness\",\"description\":\"Run your existing agent CLI on OpenRouter with any model, organization guardrails, and one bill\",\"seoTitle\":\"Ori Harness | Run Your Agent on OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Ori Harness - Run Your Agent on OpenRouter\",\"og:description\":\"Run the agent CLI you already use on OpenRouter. Choose any model, keep your organization guardrails, and get one bill across agents.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Ori%20Harness\u0026description=Run%20your%20agent%20on%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"nofollow\":false,\"icon\":\"plug\",\"href\":\"/guides/ori/harness\"},{\"title\":\"Where Ori writes files\",\"description\":\"Find the files and directories that Ori creates during a run\",\"seoTitle\":\"Where Ori writes files | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Where Ori writes files\",\"og:description\":\"Find the files and directories that Ori creates during a run.\",\"nofollow\":false,\"icon\":\"folder\",\"href\":\"/guides/ori/files\"}]},{\"group\":\"Privacy\",\"icon\":\"shield\",\"expanded\":false,\"pages\":[{\"title\":\"Data Collection\",\"description\":\"What data OpenRouter collects\",\"seoTitle\":\"Data Collection | OpenRouter Privacy\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Data Collection - OpenRouter Privacy\",\"og:description\":\"Learn what data OpenRouter collects and how it's used.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Data%20Collection\u0026description=What%20data%20OpenRouter%20collects\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"database\",\"href\":\"/guides/privacy/data-collection\"},{\"title\":\"Provider Logging\",\"description\":\"Provider logging and data retention policies\",\"seoTitle\":\"Provider Logging | Provider Data Retention\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Provider Logging - Provider Data Retention Policies\",\"og:description\":\"Understand how AI providers handle logging and data retention when you use OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Provider%20Logging\u0026description=Provider%20data%20retention%20policies\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"file-lines\",\"href\":\"/guides/privacy/provider-logging\"}]},{\"group\":\"Best Practices\",\"icon\":\"lightbulb\",\"expanded\":false,\"pages\":[{\"title\":\"Latency and Performance\",\"description\":\"Understanding OpenRouter's performance characteristics\",\"seoTitle\":\"Latency and Performance | Minimizing Gateway Latency\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Latency and Performance | Minimizing Gateway Latency\",\"og:description\":\"Learn about OpenRouter's performance characteristics, latency optimizations, and best practices for achieving optimal response times.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Latency%20and%20Performance\u0026description=Understanding%20OpenRouter's%20performance%20characteristics\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"gauge-high\",\"href\":\"/guides/best-practices/latency-and-performance\"},{\"title\":\"Prompt Caching\",\"description\":\"Cache prompt messages\",\"seoTitle\":\"Prompt Caching | Reduce AI Model Costs with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Prompt Caching - Optimize AI Model Costs with Smart Caching\",\"og:description\":\"Reduce your AI model costs with OpenRouter's prompt caching feature. Learn how to cache and reuse responses across OpenAI, Anthropic Claude, and DeepSeek models.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Prompt%20Caching\u0026description=Optimize%20AI%20model%20costs%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"database\",\"href\":\"/guides/best-practices/prompt-caching\"},{\"title\":\"Uptime Optimization\",\"description\":\"OpenRouter tracks provider availability\",\"seoTitle\":\"Uptime Optimization | Maximize AI Model Availability\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Uptime Optimization - Ensure Reliable AI Model Access\",\"og:description\":\"Learn how OpenRouter maximizes AI model uptime through real-time monitoring, intelligent routing, and automatic fallbacks across multiple providers.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Uptime%20Optimization\u0026description=Maximize%20AI%20model%20availability\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"chart-line\",\"href\":\"/guides/best-practices/uptime-optimization\"},{\"title\":\"Reasoning Tokens\",\"seoTitle\":\"Reasoning Tokens | Enhanced AI Model Reasoning with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Reasoning Tokens - Improve AI Model Decision Making\",\"og:description\":\"Learn how to use reasoning tokens to enhance AI model outputs. Implement step-by-step reasoning traces for better decision making and transparency.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Reasoning%20Tokens\u0026description=Enhance%20AI%20model%20outputs%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"lightbulb\",\"description\":null,\"href\":\"/guides/best-practices/reasoning-tokens\"}]},{\"group\":\"Community\",\"icon\":\"users\",\"expanded\":false,\"pages\":[{\"title\":\"Provider Integration\",\"seoTitle\":\"Provider Integration | Add Your AI Models to OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Provider Integration - Add Your Models to OpenRouter\",\"og:description\":\"Learn how to integrate your AI models with OpenRouter. Complete guide for providers to make their models available through OpenRouter's unified API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Provider%20Integration\u0026description=Add%20Your%20Models%20to%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"cloud\",\"sidebarTitle\":\"For Providers\",\"description\":null,\"href\":\"/guides/community/for-providers\"},{\"title\":\"Frameworks and Integrations Overview\",\"description\":\"Using OpenRouter with Popular Frameworks and Integrations\",\"seoTitle\":\"Frameworks and Integrations | OpenRouter SDK and Library Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Frameworks and Integrations - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using popular frameworks and SDKs. Complete guides for OpenAI SDK, LangChain, PydanticAI, and Vercel AI SDK integration.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Frameworks\u0026description=Frameworks%20and%20SDK%20Support\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/frameworks-and-integrations-overview\"},{\"title\":\"Awesome OpenRouter\",\"description\":\"Community-curated list of projects built with OpenRouter\",\"seoTitle\":\"Awesome OpenRouter | Community Projects and Apps\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Awesome OpenRouter - Community Projects\",\"og:description\":\"Discover community-built projects and apps powered by OpenRouter. Submit your own project to the awesome-openrouter list.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Awesome%20OpenRouter\u0026description=Community%20Projects\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"star\",\"href\":\"/guides/community/awesome-openrouter\"},{\"title\":\"Effect AI SDK\",\"description\":\"Integrate OpenRouter using the Effect AI SDK\",\"seoTitle\":\"Effect AI SDK Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Effect AI SDK Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using the Effect AI SDK. Complete guide for integrating the Effect AI SDK with OpenRouter.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Effect%20AI%20SDK\u0026description=Effect%20AI%20SDK%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/effect-ai-sdk\"},{\"title\":\"Arize AX\",\"description\":\"Using OpenRouter with Arize AX\",\"seoTitle\":\"Arize AX Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Arize AX Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using Arize AX for observability and tracing. Complete guide for Arize AX integration with OpenRouter for Python and JavaScript applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Arize%20AX\u0026description=Arize%20AX%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/arize\"},{\"title\":\"LangChain\",\"description\":\"Using OpenRouter with LangChain\",\"seoTitle\":\"LangChain Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"LangChain Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using LangChain framework. Complete guide for LangChain integration with OpenRouter for Python and JavaScript.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=LangChain\u0026description=LangChain%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/langchain\"},{\"title\":\"LiveKit\",\"description\":\"Using OpenRouter with LiveKit Agents\",\"seoTitle\":\"LiveKit Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"LiveKit Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using LiveKit Agents framework. Complete guide for LiveKit integration with OpenRouter to build voice AI agents with access to 400+ models.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=LiveKit\u0026description=LiveKit%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/livekit\"},{\"title\":\"Langfuse\",\"description\":\"Using OpenRouter with Langfuse\",\"seoTitle\":\"Langfuse Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Langfuse Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using Langfuse for observability and tracing. Complete guide for Langfuse integration with OpenRouter for Python applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Langfuse\u0026description=Langfuse%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/langfuse\"},{\"title\":\"Mastra\",\"description\":\"Using OpenRouter with Mastra\",\"seoTitle\":\"Mastra Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Mastra Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using Mastra framework. Complete guide for Mastra integration with OpenRouter for unified AI model access.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Mastra\u0026description=Mastra%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/mastra\"},{\"title\":\"OpenAI SDK\",\"description\":\"Using OpenRouter with OpenAI SDK\",\"seoTitle\":\"OpenAI SDK Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenAI SDK Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using the official OpenAI SDK. Complete guide for OpenAI SDK integration with OpenRouter for Python and TypeScript.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenAI%20SDK\u0026description=OpenAI%20SDK%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/openai-sdk\"},{\"title\":\"Anthropic Agent SDK\",\"description\":\"Using OpenRouter with the Anthropic Agent SDK\",\"seoTitle\":\"Anthropic Agent SDK Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Anthropic Agent SDK Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using the Anthropic Agent SDK. Complete guide for building AI agents with OpenRouter in Python and TypeScript.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Anthropic%20Agent%20SDK\u0026description=Anthropic%20Agent%20SDK%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/anthropic-agent-sdk\"},{\"title\":\"PydanticAI\",\"description\":\"Using OpenRouter with PydanticAI\",\"seoTitle\":\"PydanticAI Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"PydanticAI Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using PydanticAI framework. Complete guide for PydanticAI integration with OpenRouter for Python applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=PydanticAI\u0026description=PydanticAI%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/pydantic-ai\"},{\"title\":\"Render\",\"description\":\"Using OpenRouter with Render Workflows\",\"seoTitle\":\"Render Integration | OpenRouter with Render Workflows\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Render Integration - OpenRouter with Render Workflows\",\"og:description\":\"Run OpenRouter model calls inside Render Workflows with queuing, retries, and parallel task runs. Covers local development, deployment, and triggering from an app.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Render\u0026description=Using%20OpenRouter%20with%20Render%20Workflows\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/render\"},{\"title\":\"Replit\",\"description\":\"Using OpenRouter with Replit Agent and Replit Apps\",\"seoTitle\":\"Replit Integration | Add OpenRouter API Key to Replit\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Replit Integration - Add OpenRouter API Key to Replit\",\"og:description\":\"Add your OpenRouter API key to Replit to access 400+ AI models in Replit Agent and your Replit apps. Covers BYOK setup and project Secrets.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Replit\u0026description=Add%20OpenRouter%20API%20Key%20to%20Replit\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/replit\"},{\"title\":\"TanStack AI\",\"description\":\"Using OpenRouter with TanStack AI\",\"seoTitle\":\"TanStack AI Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"TanStack AI Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using TanStack AI. Complete guide for TanStack AI integration with OpenRouter for React, Solid, and Preact applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=TanStack%20AI\u0026description=TanStack%20AI%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/tanstack-ai\"},{\"title\":\"Vercel AI SDK\",\"description\":\"Using OpenRouter with Vercel AI SDK\",\"seoTitle\":\"Vercel AI SDK Integration | OpenRouter SDK Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Vercel AI SDK Integration - OpenRouter SDK Support\",\"og:description\":\"Integrate OpenRouter using Vercel AI SDK. Complete guide for Vercel AI SDK integration with OpenRouter for Next.js applications.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Vercel%20AI%20SDK\u0026description=Vercel%20AI%20SDK%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/vercel-ai-sdk\"},{\"title\":\"Xcode\",\"description\":\"Using OpenRouter with Apple Intelligence in Xcode\",\"seoTitle\":\"Xcode Integration | OpenRouter Apple Intelligence Support\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Xcode Integration - OpenRouter Apple Intelligence Support\",\"og:description\":\"Integrate OpenRouter with Apple Intelligence in Xcode 26. Complete setup guide for accessing hundreds of AI models directly in your Xcode development environment.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Xcode\u0026description=Apple%20Intelligence%20Integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/xcode\"},{\"title\":\"Zapier\",\"description\":\"Build AI automations with OpenRouter \u0026 Zapier\",\"seoTitle\":\"Zapier Integration | OpenRouter AI Automations\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Zapier Integration - OpenRouter AI Automations\",\"og:description\":\"Build powerful AI automations by connecting OpenRouter with 8000+ apps through Zapier. Access 400+ AI models in your workflows.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Zapier\u0026description=Build%20AI%20automations%20with%20OpenRouter%20%26%20Zapier\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/zapier\"},{\"title\":\"Infisical\",\"description\":\"Automatic API Key Rotation with Infisical\",\"seoTitle\":\"Infisical Integration | OpenRouter API Key Management\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Infisical Integration - OpenRouter API Key Management\",\"og:description\":\"Set up automatic API key rotation for OpenRouter using Infisical. Complete guide for secure key management and zero-downtime rotation.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Infisical\u0026description=Automatic%20API%20Key%20Rotation\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"puzzle-piece\",\"href\":\"/guides/community/infisical\"}]}]},{\"tab\":\"API Reference\",\"icon\":\"code\",\"pages\":[{\"title\":\"API Reference\",\"href\":\"/api_reference/overview\"}]},{\"tab\":\"Client SDKs\",\"icon\":\"cube\",\"pages\":[{\"title\":\"Client SDKs\",\"href\":\"/client-sdks/overview\"}]},{\"tab\":\"Agent SDK\",\"icon\":\"cube\",\"pages\":[{\"title\":\"Agent SDK\",\"href\":\"/agent-sdk/overview\"}]},{\"tab\":\"Cookbook\",\"icon\":\"book-open\",\"pages\":[{\"title\":\"Cookbook\",\"href\":\"/cookbook/get-started/quickstart\"}]}]},\"maps\":{\"firstHrefInVersion\":{},\"firstHrefInLanguage\":{}},\"children\":\"$L44\"}]\n"])</script><script>self.__next_f.push([1,"45:I[27201,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"IconMark\"]\n"])</script><script>self.__next_f.push([1,"46:I[763509,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ThemeLayout\"]\n"])</script><script>self.__next_f.push([1,"47:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"ApiReferenceProvider\"]\n"])</script><script>self.__next_f.push([1,"48:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"PageProvider\"]\n"])</script><script>self.__next_f.push([1,"40:[\"$\",\"link\",\"31\",{\"rel\":\"icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon-32x32.png\",\"type\":\"image/png\",\"sizes\":\"32x32\",\"media\":\"(prefers-color-scheme: dark)\"}]\n41:[\"$\",\"link\",\"32\",{\"rel\":\"shortcut icon\",\"href\":\"/docs/_mintlify/favicons/openrouter-d02e98a0/EmhfYwFO2tvnkuV-/_generated/favicon-dark/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"$undefined\",\"media\":\"(prefers-color-scheme: dark)\"}]\n42:[\"$\",\"$L45\",\"33\",{}]\n"])</script><script>self.__next_f.push([1,"44:[\"$\",\"$L46\",null,{\"theme\":\"mint\",\"pageMetadata\":{\"title\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"seoTitle\":\"Tool \u0026 Function Calling | Use Tools with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\",\"og:description\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"toolbox\",\"sidebarTitle\":\"Tool Calling\",\"href\":\"/guides/features/tool-calling\"},\"children\":[\"$\",\"$L47\",null,{\"value\":{\"apiReferenceData\":{},\"graphqlReferenceData\":\"$undefined\"},\"children\":[\"$\",\"$L48\",null,{\"value\":{\"pageMetadata\":\"$44:props:pageMetadata\",\"lastModified\":\"2026-07-14T17:19:40.439Z\",\"gitLastModified\":\"$undefined\",\"originalFileLocation\":\"guides/features/tool-calling.mdx\",\"description\":{\"compiledSource\":\"\\\"use strict\\\";\\nconst {jsx: _jsx} = arguments[0];\\nconst {useMDXComponents: _provideComponents} = arguments[0];\\nfunction _createMdxContent(props) {\\n  const _components = {\\n    p: \\\"p\\\",\\n    ..._provideComponents(),\\n    ...props.components\\n  };\\n  return _jsx(_components.p, {\\n    children: \\\"Use tools in your prompts\\\"\\n  });\\n}\\nfunction MDXContent(props = {}) {\\n  const {wrapper: MDXLayout} = {\\n    ..._provideComponents(),\\n    ...props.components\\n  };\\n  return MDXLayout ? _jsx(MDXLayout, {\\n    ...props,\\n    children: _jsx(_createMdxContent, {\\n      ...props\\n    })\\n  }) : _createMdxContent(props);\\n}\\nreturn {\\n  default: MDXContent\\n};\\n\",\"frontmatter\":{},\"scope\":{}},\"mdxExtracts\":{\"tableOfContents\":[{\"title\":\"Request Body Examples\",\"slug\":\"request-body-examples\",\"depth\":2,\"children\":[{\"title\":\"Step 1: Inference Request with Tools\",\"slug\":\"step-1-inference-request-with-tools\",\"depth\":3,\"children\":[]},{\"title\":\"Step 2: Tool Execution (Client-Side)\",\"slug\":\"step-2-tool-execution-client-side\",\"depth\":3,\"children\":[]},{\"title\":\"Step 3: Inference Request with Tool Results\",\"slug\":\"step-3-inference-request-with-tool-results\",\"depth\":3,\"children\":[]},{\"title\":\"Tool Calling Example\",\"slug\":\"tool-calling-example\",\"depth\":3,\"children\":[]},{\"title\":\"Define the Tool\",\"slug\":\"define-the-tool\",\"depth\":3,\"children\":[]},{\"title\":\"Tool use and tool results\",\"slug\":\"tool-use-and-tool-results\",\"depth\":3,\"children\":[]}]},{\"title\":\"Interleaved Thinking\",\"slug\":\"interleaved-thinking\",\"depth\":2,\"children\":[{\"title\":\"How Interleaved Thinking Works\",\"slug\":\"how-interleaved-thinking-works\",\"depth\":3,\"children\":[]},{\"title\":\"Example: Multi-Step Research with Reasoning\",\"slug\":\"example-multi-step-research-with-reasoning\",\"depth\":3,\"children\":[]},{\"title\":\"Best Practices for Interleaved Thinking\",\"slug\":\"best-practices-for-interleaved-thinking\",\"depth\":3,\"children\":[]},{\"title\":\"Implementation Considerations\",\"slug\":\"implementation-considerations\",\"depth\":3,\"children\":[]}]},{\"title\":\"A Simple Agentic Loop\",\"slug\":\"a-simple-agentic-loop\",\"depth\":2,\"children\":[]},{\"title\":\"Best Practices and Advanced Patterns\",\"slug\":\"best-practices-and-advanced-patterns\",\"depth\":2,\"children\":[{\"title\":\"Function Definition Guidelines\",\"slug\":\"function-definition-guidelines\",\"depth\":3,\"children\":[]},{\"title\":\"Streaming with Tool Calls\",\"slug\":\"streaming-with-tool-calls\",\"depth\":3,\"children\":[]},{\"title\":\"Tool Choice Configuration\",\"slug\":\"tool-choice-configuration\",\"depth\":3,\"children\":[]},{\"title\":\"Parallel Tool Calls\",\"slug\":\"parallel-tool-calls\",\"depth\":3,\"children\":[]},{\"title\":\"Multi-Tool Workflows\",\"slug\":\"multi-tool-workflows\",\"depth\":3,\"children\":[]},{\"title\":\"Reliability Tracking\",\"slug\":\"reliability-tracking\",\"depth\":3,\"children\":[]}]}],\"codeExamples\":{}},\"pageType\":\"$undefined\",\"panelMdxSource\":\"$undefined\",\"panelMdxSourceWithNoJs\":\"$undefined\",\"contextualStarterQuestions\":\"$undefined\",\"relatedPages\":\"$undefined\"},\"children\":\"$L49\"}]}]}]\n"])</script><script>self.__next_f.push([1,"4a:I[91557,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"OpenApiProvider\"]\n"])</script><script>self.__next_f.push([1,"4b:I[525343,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"TabSyncContextProvider\"]\n"])</script><script>self.__next_f.push([1,"4d:I[228341,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"PageModeUpdater\"]\n"])</script><script>self.__next_f.push([1,"4e:I[575126,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"Background\"]\n"])</script><script>self.__next_f.push([1,"4c:T7df,"])</script><script>self.__next_f.push([1,"{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://openrouter.ai/#organization\",\"name\":\"OpenRouter | Documentation\",\"url\":\"https://openrouter.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/openrouter-d02e98a0/ksNSeB_K7gD-BUDh/assets/logo-v2-light.svg?fit=max\u0026auto=format\u0026n=ksNSeB_K7gD-BUDh\u0026q=85\u0026s=690e45873843519efe02bcbe45795dac\"}},{\"@type\":\"WebSite\",\"@id\":\"https://openrouter.ai/docs#website\",\"name\":\"OpenRouter | Documentation\",\"url\":\"https://openrouter.ai/docs\",\"publisher\":{\"@id\":\"https://openrouter.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://openrouter.ai/docs/guides/features/tool-calling#webpage\",\"url\":\"https://openrouter.ai/docs/guides/features/tool-calling\",\"name\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"dateModified\":\"2026-07-14T17:19:40.439Z\",\"isPartOf\":{\"@id\":\"https://openrouter.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://openrouter.ai/docs/guides/features/tool-calling#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://openrouter.ai/docs/guides/features/tool-calling#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Features\",\"item\":\"https://openrouter.ai/docs/guides/features/workspaces\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tool \u0026 Function Calling\",\"item\":\"https://openrouter.ai/docs/guides/features/tool-calling\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://openrouter.ai/docs/guides/features/tool-calling#article\",\"headline\":\"Tool \u0026 Function Calling\",\"name\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"url\":\"https://openrouter.ai/docs/guides/features/tool-calling\",\"mainEntityOfPage\":{\"@id\":\"https://openrouter.ai/docs/guides/features/tool-calling#webpage\"},\"image\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\",\"dateModified\":\"2026-07-14T17:19:40.439Z\",\"publisher\":{\"@id\":\"https://openrouter.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://openrouter.ai/docs#website\"}}]}"])</script><script>self.__next_f.push([1,"4f:T1c7d,"])</script><script>self.__next_f.push([1,"/*\n * OpenRouter Docs — Bauhaus theme overrides\n *\n * Custom CSS for Mintlify to align with the bauhaus design system.\n * Uses Mintlify's exposed ID/element selectors for targeted styling.\n *\n * Brand palette:\n *   Ink #03080A   Cloud #FCFCFE   Grape #7624F4\n *   Volt #C8FF00  Coral #FF6849   Royal #035ADE\n */\n\n/* ── Code font: Geist Mono ── */\n@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600\u0026display=swap');\n\n/*\n * Inverse semantic pair mirrors packages/frontend/components/v2/theme.css.\n * Mintlify is a separate app, so its generated tooltip DOM uses the same\n * light Ink/Cloud and dark Cloud/Ink values through RGB channel variables.\n */\n:root {\n  --inverse: 3 8 10;\n  --inverse-foreground: 252 252 254;\n  --tooltip-background: var(--inverse);\n  --tooltip-foreground: var(--inverse-foreground);\n}\n\ncode,\npre,\npre code,\n.code-block code,\n[class*=\"code\"] code {\n  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n}\n\n/* ── Text selection: accent tint per DESIGN.md ── */\n::selection {\n  background: rgb(118 36 244 / 0.14);\n}\n\n.dark ::selection,\nhtml.dark ::selection {\n  background: rgb(200 255 0 / 0.14);\n  color: inherit;\n}\n\n/* ── Dark-mode accent swap: Volt (#C8FF00 = rgb(200 255 0)) per DESIGN.md ──\n * Mintlify + Tailwind use space-separated RGB: rgb(var(--primary-light) / alpha).\n * Override accent in dark mode from Grape to Volt. */\n.dark,\n[data-theme=\"dark\"],\nhtml.dark {\n  --primary: 200 255 0;\n  --primary-light: 200 255 0;\n  --primary-dark: 200 255 0;\n  --light-primary: 200 255 0;\n  --primary-foreground: 3 8 10;\n  --inverse: 252 252 254;\n  --inverse-foreground: 3 8 10;\n\n  /* ── Dark-mode border: Cloud at 14% per DESIGN.md ── */\n  --default-border-color: rgb(252 252 254 / 0.14);\n}\n\n/* ── Border radius: bauhaus 4/6/8px scale ── */\n#navbar {\n  border-radius: 0;\n}\n\n/* Sidebar active item */\n#sidebar a[aria-current=\"page\"],\nnav[aria-label=\"Pages\"] a[aria-current=\"page\"] {\n  border-radius: 8px;\n}\n\n/* Cards and code blocks */\n[data-component-part=\"code-block-root\"] {\n  border-radius: 8px;\n}\n\n/* ── Link styling per DESIGN.md ──\n * underline at 40% opacity of current color, full on hover, offset 2px */\na:not([class]) {\n  text-decoration-thickness: 1px;\n  text-underline-offset: 2px;\n  text-decoration-color: rgb(0 0 0 / 0.4);\n}\n\na:not([class]):hover {\n  text-decoration-color: currentColor;\n}\n\n.dark a:not([class]),\nhtml.dark a:not([class]) {\n  text-decoration-color: rgb(255 255 255 / 0.4);\n}\n\n.dark a:not([class]):hover,\nhtml.dark a:not([class]):hover {\n  text-decoration-color: currentColor;\n}\n\n/* ── Sidebar badges: outline style ── */\n.nav-tag-pill-text {\n  background: transparent !important;\n  color: rgb(0 0 0 / 0.5) !important;\n  border: 1px solid rgb(0 0 0 / 0.2) !important;\n}\n\n.dark .nav-tag-pill-text,\nhtml.dark .nav-tag-pill-text {\n  background: transparent !important;\n  color: rgb(252 252 254 / 0.5) !important;\n  border: 1px solid rgb(252 252 254 / 0.2) !important;\n}\n\n/* Match the home navbar logo height (h-6 / 1.5rem). */\n.nav-logo {\n  height: 1.5rem;\n}\n\n/* ── Sidebar expand chevrons: raise dark-mode contrast ──\n * Collapsible group toggles render a caret whose default dark tone\n * (gray-600 on Ink) is nearly invisible, so it isn't clear which items\n * have subsections. Derive the caret from Cloud via the DESIGN.md opacity\n * scale: muted-foreground (Cloud `a0`) at rest, full Cloud (foreground) on\n * hover — no custom hex outside the brand palette. */\n.dark nav[aria-label=\"Pages\"] button[aria-expanded] svg.transition-transform,\nhtml.dark nav[aria-label=\"Pages\"] button[aria-expanded] svg.transition-transform {\n  color: rgb(252 252 254 / 0.627);\n}\n\n.dark nav[aria-label=\"Pages\"] button[aria-expanded]:hover svg.transition-transform,\nhtml.dark nav[aria-label=\"Pages\"] button[aria-expanded]:hover svg.transition-transform {\n  color: rgb(252 252 254);\n}\n\n/* ── Sidebar expand chevrons: enlarge for legibility ──\n * The default caret (w-2 ≈ 8px) is easy to miss; bump its footprint so it\n * reads clearly as an expandable affordance. */\nnav[aria-label=\"Pages\"] button[aria-expanded] svg.transition-transform {\n  width: 0.625rem;\n  height: 0.625rem;\n}\n\n/* ── Tooltips: inverse surface pairing ──\n * Mintlify has a foreground variable for Radix tooltips but no matching\n * background variable, so both values are mirrored here from the inverse pair.\n * Radix opens tooltips as \"delayed-open\" on a normal hover but \"instant-open\"\n * when moving between triggers within its skip-delay window; cover both. */\n[data-radix-popper-content-wrapper]\n  \u003e div[data-state=\"delayed-open\"],\n[data-radix-popper-content-wrapper]\n  \u003e div[data-state=\"instant-open\"] {\n  background-color: rgb(var(--tooltip-background)) !important;\n  color: rgb(var(--tooltip-foreground)) !important;\n}\n\n/* ── Callout + code block alignment ──\n * A code block that is the only child of a callout body carries Mintlify's default\n * prose margins (mt-5 mb-8), which push the snippet down so it no longer lines\n * up with the top-aligned callout icon. Drop those margins so the snippet's\n * top edge aligns with the icon. */\n.callout [data-component-part=\"callout-content\"] \u003e .code-block:first-child {\n  margin-top: 0;\n}\n\n.callout [data-component-part=\"callout-content\"] \u003e .code-block:last-child {\n  margin-bottom: 0;\n}\n\n/* ── Floating code-block buttons: opaque background ──\n * Mintlify only backs the floating buttons (report / copy / ask) with\n * gray-100/gray-800 when the code block has no fade overlay\n * (group-[:not(:has([data-fade-overlay]))]). Collapsible/expandable blocks\n * always carry a fade overlay, so the buttons stay transparent and the code\n * text bleeds through behind them. Apply the same background unconditionally\n * so the buttons are legible on every code block. */\n[data-floating-buttons] button {\n  background-color: rgb(241 239 245);\n}\n\n.dark [data-floating-buttons] button,\nhtml.dark [data-floating-buttons] button {\n  background-color: rgb(40 38 44);\n}\n\n/* ── Changelog: Update tags as outline pills (matches sidebar badges) ── */\n[data-component-part=\"update-tag\"] {\n  border: 1px solid rgb(0 0 0 / 0.2);\n  border-radius: 9999px;\n  padding: 0.125rem 0.625rem;\n  font-size: 0.75rem;\n  line-height: 1.25rem;\n  color: rgb(0 0 0 / 0.6);\n}\n\n.dark [data-component-part=\"update-tag\"],\nhtml.dark [data-component-part=\"update-tag\"] {\n  border-color: rgb(252 252 254 / 0.2);\n  color: rgb(252 252 254 / 0.6);\n}\n\n/* ── Changelog: selected filter pill readability ──\n * Mintlify renders the active filter as bg-primary + text-white/90. In dark\n * mode our primary is Volt (#C8FF00), so switch the text to Ink per DESIGN.md. */\n.dark #changelog-filters-content button.bg-primary,\nhtml.dark #changelog-filters-content button.bg-primary {\n  color: rgb(3 8 10 / 0.9) !important;\n}\n\n/* ── Changelog: separate inline status badges from bullet text ── */\n.changelog-status-badge {\n  margin-left: 0.5rem;\n}\n\n.changelog-status-badge[data-color=\"gray\"] {\n  border: 1px solid rgb(3 8 10 / 0.3) !important;\n}\n\n.dark .changelog-status-badge[data-color=\"gray\"],\nhtml.dark .changelog-status-badge[data-color=\"gray\"] {\n  border-color: rgb(252 252 254 / 0.4) !important;\n}\n"])</script><script>self.__next_f.push([1,"49:[\"$\",\"$L4a\",null,{\"pageMetadata\":\"$44:props:pageMetadata\",\"mdxExtracts\":\"$44:props:children:props:children:props:value:mdxExtracts\",\"openApiReferenceData\":\"$undefined\",\"children\":[\"$\",\"$L4b\",null,{\"children\":[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"$4c\"}}],[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"document.documentElement.setAttribute('data-page-mode', \\\"none\\\");\"}}],[\"$\",\"$L4d\",null,{\"pageMetadata\":\"$44:props:pageMetadata\"}]],[\"$\",\"$L4e\",null,{\"pageMetadata\":\"$44:props:pageMetadata\"}],[[\"$\",\"style\",\"0\",{\"data-custom-css-index\":0,\"data-custom-css-path\":\"style.css\",\"dangerouslySetInnerHTML\":{\"__html\":\"$4f\"}}]],\"$L50\",\"$L51\"]}]}]\n"])</script><script>self.__next_f.push([1,"52:I[36098,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"CustomJsFiles\"]\n"])</script><script>self.__next_f.push([1,"54:I[530359,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"MDXContentController\"]\n"])</script><script>self.__next_f.push([1,"55:I[448287,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f5976305ab1768eb.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a5edc6734daa1561.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8195921497d29a61.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cde9521bba917b79.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0890ba15c670d9b1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/8778b596bb8e1fac.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/e157c74f66e9fd33.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f4004300900987e9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cfd727ba62f1c54c.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/58c3a30fcb9735c1.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cc5fb492c7259b04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/9a9319ba237676a4.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/a919d558158c76f7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/c7c9dfd26f25e785.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/68ad056007b94e04.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0eb894a8519f24ea.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/cb00d03b4d1e9ae2.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/f48a8fa65184b0c7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/0dd7d15c30c41f1b.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/ca83a905f88dbab7.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/555577647291460f.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/2dd53f5a4cfe6dd5.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"53:T5b9,"])</script><script>self.__next_f.push([1,"/*\n * Deep links (e.g. #response-data-pricing-overrides) can land behind the\n * sticky navbar: the browser scrolls to the anchor before hydration and\n * font loading finish, and the subsequent layout shift moves the target\n * up underneath the header. Re-align the anchor once the page has fully\n * settled, unless the user has already scrolled on their own.\n */\nlet didUserScrollAway = false;\n\nfunction markUserScrollAway() {\n  didUserScrollAway = true;\n}\n\nfunction anchorIdFromHash() {\n  const rawId = window.location.hash.slice(1);\n  try {\n    return decodeURIComponent(rawId);\n  } catch {\n    return rawId;\n  }\n}\n\nfunction realignAnchor() {\n  if (didUserScrollAway) {\n    return;\n  }\n  const target = document.querySelector(`[id=\"${CSS.escape(anchorIdFromHash())}\"]`);\n  // scrollIntoView respects the target's CSS scroll-margin-top,\n  // which Mintlify sets to clear the sticky navbar.\n  target?.scrollIntoView();\n}\n\nasync function settleAnchorScroll() {\n  await (document.fonts?.ready ?? Promise.resolve());\n  setTimeout(realignAnchor, 150);\n}\n\nfunction initAnchorScrollFix() {\n  if (!window.location.hash) {\n    return;\n  }\n  for (const event of ['wheel', 'touchmove', 'keydown']) {\n    window.addEventListener(event, markUserScrollAway, { passive: true, once: true });\n  }\n  if (document.readyState === 'complete') {\n    settleAnchorScroll();\n  } else {\n    window.addEventListener('load', settleAnchorScroll, { once: true });\n  }\n}\n\ninitAnchorScrollFix();\n"])</script><script>self.__next_f.push([1,"50:[\"$\",\"$L52\",null,{\"customJsDisabled\":false,\"jsFiles\":[{\"_id\":\"6a58359481eda2c0540fae86\",\"filePath\":\"anchor-scroll-fix.js\",\"subdomain\":\"openrouter-d02e98a0\",\"__v\":0,\"content\":\"$53\"}]}]\n56:T36123,"])</script><script>self.__next_f.push([1,"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const Template=({children,data})=\u003e{const replace=s=\u003es.replace(/\\{\\{(\\w+)\\}\\}/g,(_,k)=\u003ek in data?data[k]:`{{${k}}}`);const leafText=node=\u003etypeof node===`string`?node:node?.$$typeof\u0026\u0026typeof node.props?.children===`string`?node.props.children:null;const collapseTokens=nodes=\u003e{const out=[];let i=0;while(i\u003cnodes.length){const ta=leafText(nodes[i]);const tb=leafText(nodes[i+1]);const tc=leafText(nodes[i+2]);if(ta!=null\u0026\u0026tb!=null\u0026\u0026tc!=null){const m=(ta+tb+tc).match(/^([\\s\\S]*)\\{\\{(\\w+)\\}\\}([\\s\\S]*)$/);if(m\u0026\u0026m[2]in data){out.push(m[1]+data[m[2]]+m[3]);i+=3;continue}}out.push(nodes[i]);i++}return out};const process=node=\u003e{if(typeof node===`string`)return replace(node);if(Array.isArray(node))return collapseTokens(node.map(process));if(node\u0026\u0026typeof node===`object`){if(node.$$typeof)return{...node,props:process(node.props)};return Object.fromEntries(Object.entries(node).map(([k,v])=\u003e[k,process(v)]))}return node};return _jsx(_Fragment,{children:process(children)})};const Model={GPT_4_Omni:`openai/gpt-4o`};const API_KEY_REF=`\u003cOPENROUTER_API_KEY\u003e`;function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,_MdxComponentBoundary}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!_MdxComponentBoundary)_missingMdxReference(`_MdxComponentBoundary`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Tool calls (also known as function calls) give an LLM access to external tools. The LLM does not call the tools directly. Instead, it suggests the tool to call. The user then calls the tool separately and provides the results back to the LLM. Finally, the LLM formats the response into an answer to the user’s original question.`}),`\n`,_jsx(_components.p,{children:`OpenRouter standardizes the tool calling interface across models and providers, making it easy to integrate external tools with any supported model.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Supported Models`}),`: You can find models that support tool calling by filtering on `,_jsx(_components.a,{href:`https://openrouter.ai/models?supported_parameters=tools`,children:`openrouter.ai/models?supported_parameters=tools`}),`.`]}),`\n`,_jsx(_components.p,{children:`If you prefer to learn from a full end-to-end example, keep reading.`}),`\n`,_jsx(Heading,{level:`2`,id:`request-body-examples`,children:`Request Body Examples`}),`\n`,_jsx(_components.p,{children:`Tool calling with OpenRouter involves three key steps. Here are the essential request body formats for each step:`}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-inference-request-with-tools`,children:`Step 1: Inference Request with Tools`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`29`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`29`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google/gemini-3-flash-preview\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-tool-execution-client-side`,children:`Step 2: Tool Execution (Client-Side)`}),`\n`,_jsxs(_components.p,{children:[`After receiving the model’s response with `,_jsx(_components.code,{children:`tool_calls`}),`, execute the requested tool locally and prepare the result:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Model responds with tool_calls, you execute the tool locally`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"James\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Joyce\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-inference-request-with-tool-results`,children:`Step 3: Inference Request with Tool Results`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`48`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`48`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google/gemini-3-flash-preview\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"tool_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"call_abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"arguments\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`search_terms`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: [`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`James`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Joyce`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`]}\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"call_abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"[{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: 4300, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`title`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Ulysses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`authors`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: [{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Joyce, James`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}]}]\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Note`}),`: The `,_jsx(_components.code,{children:`tools`}),` parameter must be included in every request (Steps 1 and 3) so the router can validate the tool schema on each call.`]}),`\n`,_jsx(Heading,{level:`3`,id:`tool-calling-example`,children:`Tool Calling Example`}),`\n`,_jsx(_components.p,{children:`Here is Python code that gives LLMs the ability to call an external API — in this case Project Gutenberg, to search for books.`}),`\n`,_jsx(_components.p,{children:`First, let’s do some basic setup:`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`23`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OpenRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@openrouter/sdk'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"{{API_KEY_REF}}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// You can use any model that supports tool calling`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"{{MODEL}}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  apiKey:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` task`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"What are the titles of some James Joyce books?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"You are a helpful assistant.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` task`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`26`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`26`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json, requests`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`{{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`API_KEY_REF`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`}}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# You can use any model that supports tool calling`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai_client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/api/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`task `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are a helpful assistant.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: task,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`17`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`17`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'system'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'You are a helpful assistant.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'What are the titles of some James Joyce books?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`define-the-tool`,children:`Define the Tool`}),`\n`,_jsxs(_components.p,{children:[`Next, we define the tool that we want to call. Remember, the tool is going to get `,_jsx(_components.em,{children:`requested`}),` by the LLM, but the code we are writing here is ultimately responsible for executing the call and returning the results to the LLM.`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`41`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`searchTerms`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[])`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[]\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` searchQuery`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` searchTerms`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`join`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`' '`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://gutendex.com/books'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`?search=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchQuery`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`results`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`book`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=\u003e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    title:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`title`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    authors:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`authors`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }));`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'function'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    function:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'searchGutenbergBooks'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      description:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        'Search for books in the Project Gutenberg library based on specified search terms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      parameters:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'object'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        properties:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`          search_terms:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'array'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            items:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`              type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'string'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            description:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`              \"List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        required:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'search_terms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`42`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`42`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` search_gutenberg_books`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`search_terms`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    search_query `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \" \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.join(search_terms)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://gutendex.com/books\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: search_query})`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    simplified_results `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` book `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json().get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"results\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, []):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        simplified_results.append({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        })`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` simplified_results`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tools `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library based on specified search terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`          \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: search_gutenberg_books`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`Note that the “tool” is just a normal function. We then write a JSON “spec” compatible with the OpenAI function calling parameter. We’ll pass that spec to the LLM so that it knows this tool is available and how to use it. It will request the tool when needed, along with any arguments. We’ll then marshal the tool call locally, make the function call, and return the results to the LLM.`}),`\n`,_jsx(Heading,{level:`3`,id:`tool-use-and-tool-results`,children:`Tool use and tool results`}),`\n`,_jsx(_components.p,{children:`Let’s make the first OpenRouter API call to the model:`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tools,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: messages`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_1).message`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` request_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})]})})}),`\n`,_jsxs(_components.p,{children:[`The LLM responds with a finish reason of `,_jsx(_components.code,{children:`tool_calls`}),`, and a `,_jsx(_components.code,{children:`tool_calls`}),` array. In a generic LLM response-handler, you would want to check the `,_jsx(_components.code,{children:`finish_reason`}),` before processing tool calls, but here we will assume it’s the case. Let’s keep going, by processing the tool call:`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`16`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Append the response to the messages array so the LLM has the full context`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// It's easy to forget this step!`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Now we process the requested tool calls, and use our book lookup tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolName`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`search_params`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arguments`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResponse`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`search_params`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    toolCallId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    name:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`19`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Append the response to the messages array so the LLM has the full context`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# It's easy to forget this step!`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages.append(response_1)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Now we process the requested tool calls, and use our book lookup tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response_1.tool_calls:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    '''`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    In this case we only provided one tool, so we know what function to call.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"    When providing multiple tools, you can inspect `tool_call.function.name`\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    to figure out what function you need to call locally.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    '''`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call.function.name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_args `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(tool_call.function.arguments)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[tool_name](`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tool_args)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    messages.append({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_call.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: json.dumps(tool_response),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    })`})}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`The messages array now has:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Our original request`}),`\n`,_jsx(_components.li,{children:`The LLM’s response (containing a tool call request)`}),`\n`,_jsx(_components.li,{children:`The result of the tool call (a json object returned from the Project Gutenberg API)`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Now, we can make a second OpenRouter API call, and hopefully get our result!`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response_2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: messages,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tools`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_2)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response_2.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.content)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`The output will be something like:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Here are some books by James Joyce:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Ulysses*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Dubliners*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *A Portrait of the Artist as a Young Man*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Chamber Music*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Exiles: A Play in Three Acts*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`We did it! We’ve successfully used a tool in a prompt.`}),`\n`,_jsx(Heading,{level:`2`,id:`interleaved-thinking`,children:`Interleaved Thinking`}),`\n`,_jsx(_components.p,{children:`Interleaved thinking allows models to reason between tool calls, enabling more sophisticated decision-making after receiving tool results. This feature helps models chain multiple tool calls with reasoning steps in between and make nuanced decisions based on intermediate results.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important`}),`: Interleaved thinking increases token usage and response latency. Consider your budget and performance requirements when enabling this feature.`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-interleaved-thinking-works`,children:`How Interleaved Thinking Works`}),`\n`,_jsx(_components.p,{children:`With interleaved thinking, the model can:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Reason about the results of a tool call before deciding what to do next`}),`\n`,_jsx(_components.li,{children:`Chain multiple tool calls with reasoning steps in between`}),`\n`,_jsx(_components.li,{children:`Make more nuanced decisions based on intermediate results`}),`\n`,_jsx(_components.li,{children:`Provide transparent reasoning for its tool selection process`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`example-multi-step-research-with-reasoning`,children:`Example: Multi-Step Research with Reasoning`}),`\n`,_jsx(_components.p,{children:`Here’s an example showing how a model might use interleaved thinking to research a topic across multiple sources:`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Initial Request:`})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`41`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-sonnet-4.5\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Research the environmental impact of electric vehicles and provide a comprehensive analysis.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_academic_papers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for academic papers on a given topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"field\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_latest_statistics\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get latest statistics on a topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"year\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"integer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Model’s Reasoning and Tool Calls:`})}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Initial Thinking`}),`: “I need to research electric vehicle environmental impact. Let me start with academic papers to get peer-reviewed research.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`First Tool Call`}),`: `,_jsx(_components.code,{children:`search_academic_papers({\"query\": \"electric vehicle lifecycle environmental impact\", \"field\": \"environmental science\"})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After First Tool Result`}),`: “The papers show mixed results on manufacturing impact. I need current statistics to complement this academic research.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Second Tool Call`}),`: `,_jsx(_components.code,{children:`get_latest_statistics({\"topic\": \"electric vehicle carbon footprint\", \"year\": 2024})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After Second Tool Result`}),`: “Now I have both academic research and current data. Let me search for manufacturing-specific studies to address the gaps I found.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Third Tool Call`}),`: `,_jsx(_components.code,{children:`search_academic_papers({\"query\": \"electric vehicle battery manufacturing environmental cost\", \"field\": \"materials science\"})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Final Analysis`}),`: Synthesizes all gathered information into a comprehensive response.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`best-practices-for-interleaved-thinking`,children:`Best Practices for Interleaved Thinking`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Clear Tool Descriptions`}),`: Provide detailed descriptions so the model can reason about when to use each tool`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Structured Parameters`}),`: Use well-defined parameter schemas to help the model make precise tool calls`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Context Preservation`}),`: Maintain conversation context across multiple tool interactions`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Error Handling`}),`: Design tools to provide meaningful error messages that help the model adjust its approach`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`implementation-considerations`,children:`Implementation Considerations`}),`\n`,_jsx(_components.p,{children:`When implementing interleaved thinking:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Models may take longer to respond due to additional reasoning steps`}),`\n`,_jsx(_components.li,{children:`Token usage will be higher due to the reasoning process`}),`\n`,_jsx(_components.li,{children:`The quality of reasoning depends on the model’s capabilities`}),`\n`,_jsx(_components.li,{children:`Some models may be better suited for this approach than others`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-simple-agentic-loop`,children:`A Simple Agentic Loop`}),`\n`,_jsx(_components.p,{children:`In the example above, the calls are made explicitly and sequentially. To handle a wide variety of user inputs and tool calls, you can use an agentic loop.`}),`\n`,_jsxs(_components.p,{children:[`Here’s an example of a simple agentic loop (using the same `,_jsx(_components.code,{children:`tools`}),` and initial `,_jsx(_components.code,{children:`messages`}),` as above):`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{data:{API_KEY_REF,MODEL:`google/gemini-3-flash-preview`},children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`47`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`47`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` callLLM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[])`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ChatResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getToolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ChatResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolName`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolArgs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arguments`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Look up the correct tool locally, and call it with the provided arguments`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Other tools can be added without changing the agentic loop`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolArgs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    toolCallId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`++`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` callLLM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getToolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003e=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`warn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Warning: Maximum iterations reached\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`41`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` call_llm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msgs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tools,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`msgs`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    msgs.append(resp.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.dict())`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` get_tool_response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.tool_calls[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call.function.name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_args `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(tool_call.function.arguments)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Look up the correct tool locally, and call it with the provided arguments`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Other tools can be added without changing the agentic loop`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[tool_name](`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tool_args)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_call.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_result,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`max_iterations `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_iterations:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call_llm(_messages)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.tool_calls `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`is`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        messages.append(get_tool_response(resp))`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        break`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_iterations:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`    print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Warning: Maximum iterations reached\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(messages[`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`best-practices-and-advanced-patterns`,children:`Best Practices and Advanced Patterns`}),`\n`,_jsx(Heading,{level:`3`,id:`function-definition-guidelines`,children:`Function Definition Guidelines`}),`\n`,_jsx(_components.p,{children:`When defining tools for LLMs, follow these best practices:`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Clear and Descriptive Names`}),`: Use descriptive function names that clearly indicate the tool’s purpose.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Good: Clear and specific`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather_forecast\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Avoid: Too vague`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Comprehensive Descriptions`}),`: Provide detailed descriptions that help the model understand when and how to use the tool.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`19`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get current weather conditions and 5-day forecast for a specific location. Supports cities, zip codes, and coordinates.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"location\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"City name, zip code, or coordinates (lat,lng). Examples: 'New York', '10001', '40.7128,-74.0060'\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"units\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"enum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"celsius\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"fahrenheit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Temperature unit preference\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"celsius\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"location\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`streaming-with-tool-calls`,children:`Streaming with Tool Calls`}),`\n`,_jsx(_components.p,{children:`When using streaming responses with tool calls, handle the different content types appropriately:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`40`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`40`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'/api/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'anthropic/claude-sonnet-4.5'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` reader`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getReader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCalls`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [];`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` chunk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` TextDecoder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`decode`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` lines`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`split`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`filter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =\u003e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trim`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lines`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`startsWith`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'data: '`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`      const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`slice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`      if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`      if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool_calls'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` handleToolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'stop'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`        // Regular completion without tool calls`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`tool-choice-configuration`,children:`Tool Choice Configuration`}),`\n`,_jsxs(_components.p,{children:[`Control tool usage with the `,_jsx(_components.code,{children:`tool_choice`}),` parameter:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Let model decide (default)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Disable tool usage`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"none\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Force specific tool`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_database\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`parallel-tool-calls`,children:`Parallel Tool Calls`}),`\n`,_jsxs(_components.p,{children:[`Control whether multiple tools can be called simultaneously with the `,_jsx(_components.code,{children:`parallel_tool_calls`}),` parameter (default is true for most models):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Disable parallel tool calls - tools will be called sequentially`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"parallel_tool_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`parallel_tool_calls`}),` is `,_jsx(_components.code,{children:`false`}),`, the model will only request one tool call at a time instead of potentially multiple calls in parallel.`]}),`\n`,_jsx(Heading,{level:`3`,id:`multi-tool-workflows`,children:`Multi-Tool Workflows`}),`\n`,_jsx(_components.p,{children:`Design tools that work well together:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`25`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`25`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_products\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for products in the catalog\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_product_details\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get detailed information about a specific product\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"check_inventory\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Check current inventory levels for a product\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This allows the model to naturally chain operations: search → get details → check inventory.`}),`\n`,_jsx(Heading,{level:`3`,id:`reliability-tracking`,children:`Reliability Tracking`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter tracks how reliably each provider completes tool calls and surfaces this as the `,_jsx(_components.strong,{children:`Tool Call Error Rate`}),` on the Performance tab of every model page. The same signal drives `,_jsx(_components.a,{href:`/guides/routing/auto-exacto`,children:`Auto Exacto`}),` provider ordering on tool-calling requests. For the exact validator, JSON Schema draft, regex semantics, and per-tool-call classification, see `,_jsx(_components.a,{href:`/guides/routing/auto-exacto#how-tool-calling-success-rate-is-measured`,children:`How Tool-Calling Success Rate Is Measured`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For more details on OpenRouter’s message format and tool parameters, see the `,_jsx(_components.a,{href:`/api_reference/overview`,children:`API Reference`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{Template,Model,API_KEY_REF,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"])</script><script>self.__next_f.push([1,"57:T35bfe,"])</script><script>self.__next_f.push([1,"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const Template=()=\u003enull;const Model=undefined;const API_KEY_REF=undefined;function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,_MdxComponentBoundary}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!_MdxComponentBoundary)_missingMdxReference(`_MdxComponentBoundary`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Tool calls (also known as function calls) give an LLM access to external tools. The LLM does not call the tools directly. Instead, it suggests the tool to call. The user then calls the tool separately and provides the results back to the LLM. Finally, the LLM formats the response into an answer to the user’s original question.`}),`\n`,_jsx(_components.p,{children:`OpenRouter standardizes the tool calling interface across models and providers, making it easy to integrate external tools with any supported model.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Supported Models`}),`: You can find models that support tool calling by filtering on `,_jsx(_components.a,{href:`https://openrouter.ai/models?supported_parameters=tools`,children:`openrouter.ai/models?supported_parameters=tools`}),`.`]}),`\n`,_jsx(_components.p,{children:`If you prefer to learn from a full end-to-end example, keep reading.`}),`\n`,_jsx(Heading,{level:`2`,id:`request-body-examples`,children:`Request Body Examples`}),`\n`,_jsx(_components.p,{children:`Tool calling with OpenRouter involves three key steps. Here are the essential request body formats for each step:`}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-inference-request-with-tools`,children:`Step 1: Inference Request with Tools`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`29`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`29`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google/gemini-3-flash-preview\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-tool-execution-client-side`,children:`Step 2: Tool Execution (Client-Side)`}),`\n`,_jsxs(_components.p,{children:[`After receiving the model’s response with `,_jsx(_components.code,{children:`tool_calls`}),`, execute the requested tool locally and prepare the result:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Model responds with tool_calls, you execute the tool locally`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"James\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Joyce\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-inference-request-with-tool-results`,children:`Step 3: Inference Request with Tool Results`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`48`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`48`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google/gemini-3-flash-preview\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"tool_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"call_abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"arguments\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`search_terms`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: [`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`James`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Joyce`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`]}\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"call_abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"[{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: 4300, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`title`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Ulysses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`authors`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: [{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Joyce, James`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}]}]\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`              \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Note`}),`: The `,_jsx(_components.code,{children:`tools`}),` parameter must be included in every request (Steps 1 and 3) so the router can validate the tool schema on each call.`]}),`\n`,_jsx(Heading,{level:`3`,id:`tool-calling-example`,children:`Tool Calling Example`}),`\n`,_jsx(_components.p,{children:`Here is Python code that gives LLMs the ability to call an external API — in this case Project Gutenberg, to search for books.`}),`\n`,_jsx(_components.p,{children:`First, let’s do some basic setup:`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`23`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OpenRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@openrouter/sdk'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"{{API_KEY_REF}}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// You can use any model that supports tool calling`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"{{MODEL}}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  apiKey:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` task`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"What are the titles of some James Joyce books?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"You are a helpful assistant.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` task`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`26`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`26`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json, requests`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`{{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`API_KEY_REF`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`}}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# You can use any model that supports tool calling`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai_client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/api/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`OPENROUTER_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`task `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"What are the titles of some James Joyce books?\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are a helpful assistant.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: task,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`17`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`17`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'system'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'You are a helpful assistant.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'What are the titles of some James Joyce books?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`define-the-tool`,children:`Define the Tool`}),`\n`,_jsxs(_components.p,{children:[`Next, we define the tool that we want to call. Remember, the tool is going to get `,_jsx(_components.em,{children:`requested`}),` by the LLM, but the code we are writing here is ultimately responsible for executing the call and returning the results to the LLM.`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`41`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`searchTerms`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[])`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[]\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` searchQuery`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` searchTerms`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`join`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`' '`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://gutendex.com/books'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`?search=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchQuery`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`results`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`book`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=\u003e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    title:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`title`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    authors:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` book`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`authors`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }));`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'function'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    function:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'searchGutenbergBooks'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      description:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        'Search for books in the Project Gutenberg library based on specified search terms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      parameters:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'object'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        properties:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`          search_terms:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'array'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            items:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`              type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'string'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`            description:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`              \"List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        required:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'search_terms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  searchGutenbergBooks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`42`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`42`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` search_gutenberg_books`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`search_terms`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    search_query `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \" \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.join(search_terms)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://gutendex.com/books\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: search_query})`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    simplified_results `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` book `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json().get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"results\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, []):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        simplified_results.append({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: book.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        })`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` simplified_results`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tools `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for books in the Project Gutenberg library based on specified search terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`          \"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"array\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`              \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_terms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"search_gutenberg_books\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: search_gutenberg_books`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`Note that the “tool” is just a normal function. We then write a JSON “spec” compatible with the OpenAI function calling parameter. We’ll pass that spec to the LLM so that it knows this tool is available and how to use it. It will request the tool when needed, along with any arguments. We’ll then marshal the tool call locally, make the function call, and return the results to the LLM.`}),`\n`,_jsx(Heading,{level:`3`,id:`tool-use-and-tool-results`,children:`Tool use and tool results`}),`\n`,_jsx(_components.p,{children:`Let’s make the first OpenRouter API call to the model:`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tools,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: messages`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_1).message`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` request_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})]})})}),`\n`,_jsxs(_components.p,{children:[`The LLM responds with a finish reason of `,_jsx(_components.code,{children:`tool_calls`}),`, and a `,_jsx(_components.code,{children:`tool_calls`}),` array. In a generic LLM response-handler, you would want to check the `,_jsx(_components.code,{children:`finish_reason`}),` before processing tool calls, but here we will assume it’s the case. Let’s keep going, by processing the tool call:`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`16`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Append the response to the messages array so the LLM has the full context`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// It's easy to forget this step!`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Now we process the requested tool calls, and use our book lookup tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response_1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolName`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`search_params`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arguments`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResponse`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`search_params`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    toolCallId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    name:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`19`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Append the response to the messages array so the LLM has the full context`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# It's easy to forget this step!`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages.append(response_1)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Now we process the requested tool calls, and use our book lookup tool`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response_1.tool_calls:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    '''`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    In this case we only provided one tool, so we know what function to call.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"    When providing multiple tools, you can inspect `tool_call.function.name`\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    to figure out what function you need to call locally.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    '''`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call.function.name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_args `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(tool_call.function.arguments)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[tool_name](`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tool_args)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    messages.append({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_call.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: json.dumps(tool_response),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    })`})}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`The messages array now has:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Our original request`}),`\n`,_jsx(_components.li,{children:`The LLM’s response (containing a tool call request)`}),`\n`,_jsx(_components.li,{children:`The result of the tool call (a json object returned from the Project Gutenberg API)`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Now, we can make a second OpenRouter API call, and hopefully get our result!`}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response_2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response_2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: messages,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tools`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`request_2)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response_2.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.content)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript (fetch)`,lines:`true`,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://openrouter.ai/api/v1/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer {{API_KEY_REF}}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})})]})})}),`\n`,_jsx(_components.p,{children:`The output will be something like:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Here are some books by James Joyce:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Ulysses*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Dubliners*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *A Portrait of the Artist as a Young Man*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Chamber Music*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`*   *Exiles: A Play in Three Acts*`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`We did it! We’ve successfully used a tool in a prompt.`}),`\n`,_jsx(Heading,{level:`2`,id:`interleaved-thinking`,children:`Interleaved Thinking`}),`\n`,_jsx(_components.p,{children:`Interleaved thinking allows models to reason between tool calls, enabling more sophisticated decision-making after receiving tool results. This feature helps models chain multiple tool calls with reasoning steps in between and make nuanced decisions based on intermediate results.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important`}),`: Interleaved thinking increases token usage and response latency. Consider your budget and performance requirements when enabling this feature.`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-interleaved-thinking-works`,children:`How Interleaved Thinking Works`}),`\n`,_jsx(_components.p,{children:`With interleaved thinking, the model can:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Reason about the results of a tool call before deciding what to do next`}),`\n`,_jsx(_components.li,{children:`Chain multiple tool calls with reasoning steps in between`}),`\n`,_jsx(_components.li,{children:`Make more nuanced decisions based on intermediate results`}),`\n`,_jsx(_components.li,{children:`Provide transparent reasoning for its tool selection process`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`example-multi-step-research-with-reasoning`,children:`Example: Multi-Step Research with Reasoning`}),`\n`,_jsx(_components.p,{children:`Here’s an example showing how a model might use interleaved thinking to research a topic across multiple sources:`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Initial Request:`})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`41`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-sonnet-4.5\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Research the environmental impact of electric vehicles and provide a comprehensive analysis.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_academic_papers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for academic papers on a given topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"field\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_latest_statistics\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get latest statistics on a topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`            \"year\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"integer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`          },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"topic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Model’s Reasoning and Tool Calls:`})}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Initial Thinking`}),`: “I need to research electric vehicle environmental impact. Let me start with academic papers to get peer-reviewed research.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`First Tool Call`}),`: `,_jsx(_components.code,{children:`search_academic_papers({\"query\": \"electric vehicle lifecycle environmental impact\", \"field\": \"environmental science\"})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After First Tool Result`}),`: “The papers show mixed results on manufacturing impact. I need current statistics to complement this academic research.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Second Tool Call`}),`: `,_jsx(_components.code,{children:`get_latest_statistics({\"topic\": \"electric vehicle carbon footprint\", \"year\": 2024})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After Second Tool Result`}),`: “Now I have both academic research and current data. Let me search for manufacturing-specific studies to address the gaps I found.”`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Third Tool Call`}),`: `,_jsx(_components.code,{children:`search_academic_papers({\"query\": \"electric vehicle battery manufacturing environmental cost\", \"field\": \"materials science\"})`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Final Analysis`}),`: Synthesizes all gathered information into a comprehensive response.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`best-practices-for-interleaved-thinking`,children:`Best Practices for Interleaved Thinking`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Clear Tool Descriptions`}),`: Provide detailed descriptions so the model can reason about when to use each tool`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Structured Parameters`}),`: Use well-defined parameter schemas to help the model make precise tool calls`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Context Preservation`}),`: Maintain conversation context across multiple tool interactions`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Error Handling`}),`: Design tools to provide meaningful error messages that help the model adjust its approach`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`implementation-considerations`,children:`Implementation Considerations`}),`\n`,_jsx(_components.p,{children:`When implementing interleaved thinking:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Models may take longer to respond due to additional reasoning steps`}),`\n`,_jsx(_components.li,{children:`Token usage will be higher due to the reasoning process`}),`\n`,_jsx(_components.li,{children:`The quality of reasoning depends on the model’s capabilities`}),`\n`,_jsx(_components.li,{children:`Some models may be better suited for this approach than others`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-simple-agentic-loop`,children:`A Simple Agentic Loop`}),`\n`,_jsx(_components.p,{children:`In the example above, the calls are made explicitly and sequentially. To handle a wide variety of user inputs and tool calls, you can use an agentic loop.`}),`\n`,_jsxs(_components.p,{children:[`Here’s an example of a simple agentic loop (using the same `,_jsx(_components.code,{children:`tools`}),` and initial `,_jsx(_components.code,{children:`messages`}),` as above):`]}),`\n`,_jsx(_MdxComponentBoundary,{name:`Template`,children:_jsx(Template,{children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript SDK`,lines:`true`,expandable:`true`,numberOfLines:`47`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`47`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` callLLM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[])`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ChatResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openRouter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{{MODEL}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` result`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getToolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ChatResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolName`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolArgs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arguments`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Look up the correct tool locally, and call it with the provided arguments`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Other tools can be added without changing the agentic loop`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolArgs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    toolCallId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCall`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolResult`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`++`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` callLLM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getToolResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`iterationCount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003e=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxIterations`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`warn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Warning: Maximum iterations reached\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,lines:`true`,expandable:`true`,numberOfLines:`41`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`41`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` call_llm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msgs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai_client.chat.completions.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tools,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`msgs`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    msgs.append(resp.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.dict())`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` get_tool_response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.tool_calls[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool_call.function.name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_args `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(tool_call.function.arguments)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Look up the correct tool locally, and call it with the provided arguments`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Other tools can be added without changing the agentic loop`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    tool_result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` TOOL_MAPPING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[tool_name](`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tool_args)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"tool_call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_call.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_result,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`max_iterations `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_iterations:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call_llm(_messages)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.tool_calls `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`is`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        messages.append(get_tool_response(resp))`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        break`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` iteration_count `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_iterations:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`    print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Warning: Maximum iterations reached\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(messages[`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`best-practices-and-advanced-patterns`,children:`Best Practices and Advanced Patterns`}),`\n`,_jsx(Heading,{level:`3`,id:`function-definition-guidelines`,children:`Function Definition Guidelines`}),`\n`,_jsx(_components.p,{children:`When defining tools for LLMs, follow these best practices:`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Clear and Descriptive Names`}),`: Use descriptive function names that clearly indicate the tool’s purpose.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Good: Clear and specific`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather_forecast\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Avoid: Too vague`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Comprehensive Descriptions`}),`: Provide detailed descriptions that help the model understand when and how to use the tool.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`19`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get current weather conditions and 5-day forecast for a specific location. Supports cities, zip codes, and coordinates.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"location\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"City name, zip code, or coordinates (lat,lng). Examples: 'New York', '10001', '40.7128,-74.0060'\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"units\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"enum\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"celsius\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"fahrenheit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Temperature unit preference\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"celsius\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"location\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`streaming-with-tool-calls`,children:`Streaming with Tool Calls`}),`\n`,_jsx(_components.p,{children:`When using streaming responses with tool calls, handle the different content types appropriately:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`40`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`40`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'/api/chat/completions'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`  body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'anthropic/claude-sonnet-4.5'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    tools:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` reader`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getReader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolCalls`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [];`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` chunk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` TextDecoder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`decode`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` lines`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`split`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`filter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =\u003e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trim`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lines`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`startsWith`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'data: '`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`      const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`slice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`      if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`push`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_calls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`      if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tool_calls'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` handleToolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toolCalls`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'stop'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`        // Regular completion without tool calls`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        break`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`tool-choice-configuration`,children:`Tool Choice Configuration`}),`\n`,_jsxs(_components.p,{children:[`Control tool usage with the `,_jsx(_components.code,{children:`tool_choice`}),` parameter:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Let model decide (default)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Disable tool usage`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"none\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Force specific tool`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tool_choice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_database\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`parallel-tool-calls`,children:`Parallel Tool Calls`}),`\n`,_jsxs(_components.p,{children:[`Control whether multiple tools can be called simultaneously with the `,_jsx(_components.code,{children:`parallel_tool_calls`}),` parameter (default is true for most models):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Disable parallel tool calls - tools will be called sequentially`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"parallel_tool_calls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`parallel_tool_calls`}),` is `,_jsx(_components.code,{children:`false`}),`, the model will only request one tool call at a time instead of potentially multiple calls in parallel.`]}),`\n`,_jsx(Heading,{level:`3`,id:`multi-tool-workflows`,children:`Multi-Tool Workflows`}),`\n`,_jsx(_components.p,{children:`Design tools that work well together:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`25`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`25`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search_products\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Search for products in the catalog\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_product_details\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get detailed information about a specific product\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"check_inventory\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`        \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Check current inventory levels for a product\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This allows the model to naturally chain operations: search → get details → check inventory.`}),`\n`,_jsx(Heading,{level:`3`,id:`reliability-tracking`,children:`Reliability Tracking`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter tracks how reliably each provider completes tool calls and surfaces this as the `,_jsx(_components.strong,{children:`Tool Call Error Rate`}),` on the Performance tab of every model page. The same signal drives `,_jsx(_components.a,{href:`/guides/routing/auto-exacto`,children:`Auto Exacto`}),` provider ordering on tool-calling requests. For the exact validator, JSON Schema draft, regex semantics, and per-tool-call classification, see `,_jsx(_components.a,{href:`/guides/routing/auto-exacto#how-tool-calling-success-rate-is-measured`,children:`How Tool-Calling Success Rate Is Measured`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For more details on OpenRouter’s message format and tool parameters, see the `,_jsx(_components.a,{href:`/api_reference/overview`,children:`API Reference`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{Template,Model,API_KEY_REF,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"])</script><script>self.__next_f.push([1,"51:[\"$\",\"$L54\",null,{\"slug\":\"guides/features/tool-calling\",\"pageMetadata\":\"$44:props:pageMetadata\",\"theme\":\"mint\",\"children\":[\"$\",\"$L55\",null,{\"mdxSource\":{\"compiledSource\":\"$56\",\"frontmatter\":{},\"scope\":{\"config\":{},\"pageMetadata\":{\"title\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"seoTitle\":\"Tool \u0026 Function Calling | Use Tools with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\",\"og:description\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"toolbox\",\"sidebarTitle\":\"Tool Calling\",\"href\":\"/guides/features/tool-calling\"}}},\"mdxSourceWithNoJs\":{\"compiledSource\":\"$57\",\"frontmatter\":{},\"scope\":{\"config\":{},\"pageMetadata\":{\"title\":\"Tool \u0026 Function Calling\",\"description\":\"Use tools in your prompts\",\"seoTitle\":\"Tool \u0026 Function Calling | Use Tools with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Tool \u0026 Function Calling - Use Tools with OpenRouter\",\"og:description\":\"Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Tool%20\u0026%20Function%20Calling\u0026description=Use%20tools%20with%20OpenRouter\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"toolbox\",\"sidebarTitle\":\"Tool Calling\",\"href\":\"/guides/features/tool-calling\"}}},\"displayDomain\":\"openrouter.ai/docs\"}]}]\n"])</script><script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon='{"version":"2024.11.0","token":"805cc649ceeb4d638e3690a3ff168bfe"}' crossorigin="anonymous"></script>
<script>(function(){function c(){var b=a.contentDocument||(a.contentWindow&&a.contentWindow.document);if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a2e964ea7f831544',t:'MTc4NzMxMjc1NA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body></html>